Skip to content

Instantly share code, notes, and snippets.

@neelriyer
Created July 12, 2020 23:17
Show Gist options
  • Save neelriyer/4778d6be6c5b234121b84c79b4b7dae7 to your computer and use it in GitHub Desktop.
Save neelriyer/4778d6be6c5b234121b84c79b4b7dae7 to your computer and use it in GitHub Desktop.
Collab filtering create data bunch
from fastai.collab import *
from fastai.tabular import *
user_name = 'userId'
item_name = 'movieId'
rating_name = 'rating'
x = ratings.drop([rating_name, 'timestamp'],axis=1)
y = ratings[rating_name].astype(np.float32)
data = ColumnarModelData.from_data_frame(path, val_idxs, x, y, [user_name, item_name], bs=64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment