# Recommender systems

The best example of the recommender system is “ amazon recommends us products based on other customer ratings ”. Basically, there are two types of recommender systems

• Content based recommendation
• Collaborative filtering recommender system.

Collaborative filtering produces recommendations based on the knowledge of users’ attitude to items, that it uses the “wisdom of the crowd” to recommend items. Here this system is best for amazon recommender system.

Content based recommender systems focus on the attributes of the items and give us a recommendation based on the similarity between those.

Generally when both of these recommender systems are compared then it is noticed that collaborative filtering is more commonly used than content based systems because it usually gives better results and is relatively easy to understand.

## And the further collaborative filtering commander system is classified into two types they are:

• Memory-based Recommender system
•  model based recommender system.

Now we would work it a data set of movies where the movies and the people have given rating to the those movies. This data set is available on the website kaggle.com.

Step-1:

Important all the libraries for data manipulation, data visualization, mathematical and logical operations.

Step-2:

Let us import the dataset of movies and ratings.

User-id is the id of the person who watched the movie, item-id is the unique id number of movie, this column could be eliminated.

Now let us remove few unnecessary columns:

Now let us explore and visualize data.

Basically if observed carefully movie with most highest average rating would be considered as  a good movie, now let us apply groupby algorithm and find out the mean of ratings for each movie.

Now it could be possible that a movie with average rating 5 may have only rating and movie with 4.9 rating may have 100+ rating, so let us have count of number of rating to each of the movie.

Now let us create a dataset of the movies with average rating and number of ratings.

Now let us visualize the data using pandas built in visualization.

These are the two plots that show an overview of our data.

As we know that there should be a relation shown between number of ratings and rating of each movie using jointplot.

This jointplot shows that as the number of ratings increases then the rating also increases.

Now we would like to correlate all the movies with few particular movies, so that when user watches one movie then it recommends with respect to the watched movie.

Now let us built a pivot table.

Now let us select few movies to which the other movies should be correlated.

Now let us correlate these with using a function as below:

It will be showing a kind of error , but everything would be fine.

This is the final recommender system model we have built.