from fastai.collab import * # Quick access to collab filtering functionality path = untar_data(URLs.ML_SAMPLE) path ratings = pd.read_csv(path/'ratings.csv') series2cat(ratings, 'userId', 'movieId') ratings.head() data = CollabDataBunch.from_df(ratings, seed=42) y_range = [0, 5.5] learn = collab_learner(data, n_factors=50, y_range=y_range) learn.fit_one_cycle(4, 5e-3) learn.predict(ratings.iloc[0])