Collaborative filtering algorithm for machine learning (recommender system)

Source: Internet
Author: User

Objective

The following is a personal learning after the sentiment, reprint please indicate the source ~

Brief introduction

Many sites have referral systems that recommend the information we want or might need, so how does it happen? Because they

Have adopted the recommendation algorithm, in today's recommendation algorithm, the most widely recognized and adopted is the collaborative filtering algorithm.

Collaborative filtering algorithm

The so-called content-based recommendation, which means that our item has some attribute attrs, then we can pass a history score record for a user ,calculates the user's preference for various attribute attr, which allows the user to recommend the item with his favorite attr. For example, every movie is made up of romantic and action attributes, such as                                  for Alice, for example, she scored high on the top 2 romance-style films and scored 0 for the last 2 action types, so the 3rdThe movie 's attribute list indicates that the movie was romance style, is it possible to predict Alice's score on the film might be higher?! Of course! In fact, for Alice, this user is a problem that we already know about linear regression. x is the attrs vector of the movie, Y is usedthe user's rating. The theta we ask for is the user's preference for various attrs. See formula:                                        its algorithm, is to use gradient descent method, each step update theta can, see, do not say more.                                          consider a question:the intrinsic properties of item are not always available. Even if there is, according to the General People's ideas, may also have to use a lot of manpower to fill, and may not be accurate. recall that content-based recommendations are known as Y and X for Theta. If we know Y and theta, we can find X.                                         So, if you give theta a very small initialization value, you can use the above two formulas to solve the X and Theta. our great predecessors found a better way to merge the two linear regression, as                                       after the merger, our optimization goals areJ ( Theta) and J (X) became J (theta,x). The algorithm is described as follows:                                       here, we do not need the special case of k = 0, because we do not need to add x=1 this element manually. If X=1 is needed, the collaborative filtering algorithm will calculatea x=1. The algorithm description ends here. So, why is this algorithm called Matrix decomposition algorithm? See, we convert the y matrix to the product of Theta and x two matrices.                                           So, how to find the most similar to movie I 5 movie it? Calculate Distance:                             the distance may be very large. Better computing distances or similar methods have Pearson similarity, cosine similarity, Euler distance similarity, and so on, these similaritythe range of values is between -1~1.  If a user is new, does not have any scoring records, how to recommend him? If a user does not have a scoring record, then the CF method calculates the score is 0. It's not worth it, it's better to give him an average. Concrete implementation See:                                                  calculates the average score for each movie. Then all the scores are subtracted from the average to calculate. The calculated results are added to the average.

  

The above is the whole content, if there is something wrong, please leave a message below, thank you ~

Collaborative filtering algorithm for machine learning (recommender system)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.