Nowadays, recommendation algorithms have penetrated into every aspect of our lives. For example, Taobao recommends the goods we want to buy according to our previous browsing history. Douyin constantly recommends all kinds of videos that we are interested in (although I personally don’t like Douyin and think it will make us lose our ability to think independently, but its recommendation algorithm is very good)


.


These recommendation algorithms greatly facilitate our life. As a student of machine learning, how can we not pay attention to recommendation algorithms?


Here’s an example: There’s a movie recommendation system that allows users to rate movies on a scale of 0 to 5. Some movies are not rated as unknown, and the ultimate goal is to use a recommendation algorithm to recommend certain movies to users who might be interested in them.

The green circle indicates that it is a kind of love movie, and the red circle indicates that it is an action movie. It can be seen from the above data that the first two users may be interested in love movie, while the last two users may be interested in action movie. Based on this, we can use a method similar to linear regression to predict the possible ratings of users who have not seen the movie. Before using this method, we need to work out the characteristics of each movie:

Then, the specific methods are as follows:

A little bit different from linear regression is that it leaves out 1 over m. This is a prediction for one user, and to consider all users, the sum is:

And then gradient descent… You end up with a content-based recommendation algorithm.




Ps. This article is based on the study notes of Ng’s machine learning course. If you want to learn machine learning together, you can follow the wechat public account “SuperFeng”, looking forward to meeting you.