So for the last two days I spent hours scratching my head on the best way to get inference from a trained collaberative filtering model from the MovieLense chapter 7 & chapter 8(videos) example. I was about to ask here on the forums when I found the answer in the Lesson 5 Titanic video. The key is to use these two lines once you’ve trained your model:
tst_dl = learn.dls.test_dl(tst_df)
and
preds,_ = learn.get_preds(dl=tst_dl)
I added a few of my own movie reviews as I was inspired by this post from fastai 1.
here is the code I actually used:
learn.save('movie_predictor_large_ds_01')
tst_dl = learn.dls.test_dl(ratings)
preds,_=learn.get_preds(dl=tst_dl)
ratings['rating_preds'] = preds
ratings[ratings.user==999].sort_values(by='rating',ascending=False)
I hop this helps someone else and saves them all the hours it took me. cheers!