Member-only story

KNN Based Collaborative Filtering In Python using Surprise

Pankaj Kumar
4 min readDec 7, 2019

--

Photo by Patrick Tomasso on Unsplash

Collaborative filtering is one of the simplest approaches for recommendation systems. I am going to use python surprise package to make a simple recommendation system. In collaborative filtering we rely on other user’s rating on common items to determine the rating of an item for a user when the item is already rated by other users and we have already established a similarity parameter in those users. There are some issues we are going to address while trying to create a recommendation system based on collaborative filtering.

First question is how to calculate similarity between users. How to calculate the similarity between users when most of the ratings from them is missing for the items they have not rated.

Introduction to the dataset

Dataset for collaborative filtering usually contains 3 columns. user id , itemid and rating. We have a related dataset for details of users and items separately so that we can do some analysis on those items and users. items can either br movies , books, products or anything that a user can rate.

In our case we are going to use a movies dataset and we ‘ll keep our dataset simple for illustration purpose.

Our dataset is for illustration purpose so I have kept it simple and easily…

--

--

Pankaj Kumar
Pankaj Kumar

Written by Pankaj Kumar

MS Data Science SMU TX, MSc Financial Engg WQU. Interest in Algos, Discovering Trends in data. Worked 4 Hedge Funds n Inv banks https://vitvinyas.onrender.com/

Responses (2)

Write a response