From the course: Building Recommender Systems with Machine Learning and AI
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Running user- and item-based KNN on MovieLens - Python Tutorial
From the course: Building Recommender Systems with Machine Learning and AI
Running user- and item-based KNN on MovieLens
- [Instructor] Okay, so let's head back to Spyder, and this time have a look at the KNNBakeOff file inside our collaborative filtering folder. As I said, surpriselib will do most of the work for us here. We just have to tell it what we want to do. We're importing the KNNBasic package because that's what implements both user-based and item-based KNN recommendations as we've described them. All we do is create one instance with the user_based set to True and another to False and pit them against each other, and also the Random recommender as a baseline. We will print out accuracy metrics, but in the interest of time, we'll just sample the top end recommender results. You can certainly pass True to the evaluate function if you want to get hit rate metrics as well, but it will take a lot longer to run. Let's kick it off, and we'll come back in a few minutes, when it's done. So let's take a look at the accuracy results. This is interesting. Both user-based and item-based have about the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Measuring similarity and sparsity4m 49s
-
(Locked)
Similarity metrics8m 32s
-
User-based collaborative filtering7m 25s
-
(Locked)
User-based collaborative filtering: Hands-on4m 59s
-
(Locked)
Item-based collaborative filtering4m 14s
-
(Locked)
Item-based collaborative filtering: Hands-on2m 23s
-
(Locked)
Tuning collaborative filtering algorithms3m 31s
-
(Locked)
Evaluating collaborative filtering systems offline1m 28s
-
(Locked)
Measure the hit rate of item-based collaborative filtering2m 17s
-
(Locked)
KNN recommenders4m 4s
-
(Locked)
Running user- and item-based KNN on MovieLens2m 26s
-
(Locked)
Experiment with different KNN parameters4m 25s
-
(Locked)
Bleeding edge alert: Translation-based recommendations2m 29s
-
(Locked)
-
-
-
-
-
-
-
-