A simple collaborative filtering recommendation algorithm

Source: Internet
Author: User

1. Introduction of recommendation System

Personalized recommendation is based on the user's interest characteristics and purchase behavior, to users to recommend users interested in information and products.

2, recommended system classification2.1 Content-based recommendations (content-based recommendation)

The core idea of content-based recommender system is to excavate the information of the recommended object. the premise of the content-based recommendation algorithm is that if the user likes item A, then the user should also like an item similar to a. as the author's aim is to introduce collaborative filtering recommendation algorithms, a simple example of a content-based recommendation algorithm is presented:

  Suppose a song has 4 attributes: Name, singer, style, composer. If user Alice has a high beat it score for Michael's song, the system will analyze the properties of the Beat It song, and then the system might recommend Michael's song dangerous to Alice because dangerous and beat It has a lot in common: the singers are Michael, and the style is rock and roll.

Generally speaking, based on the content of the recommendation, the use of the proposed object's own property information, using this information to cluster, such as the number of songs by style clustering, to get the blues-style song collection, rock style collection, pastoral style collection and so on, when the user expressed like a certain song, The system will analyze which style the song belongs to, and if the song belongs to rock and roll style, then the system will pick out some songs from the rock-style collection and recommend them to the user. Of course, this is only a way of thinking, the actual content-based recommendations than I described to be more complex and detailed, interested friends can delve into, I will be free after the content-based recommendation algorithm to do a detailed introduction.

2.2 Collaborative filtering recommendations (collaborative Filtering recommendation) Collaborative filtering algorithm is the most widely used and successful algorithm in Recommender system. The premise of the collaborative filtering recommendation algorithm is that if both user A and User B are interested in a series of identical items, a will probably also like other items that B users like. in the process of collaborative filtering recommendation: The user first evaluates each item , calculates the similarity between the different user ratings, can find the nearest neighbor, according to the nearest neighbor's evaluation, produces the recommendation-- This is the main idea of the collaborative filtering algorithm. For example, suppose that in the music recommendation system, there are altogether 4 users, 7 music, each user to each music evaluation Matrix is as follows:
All on that Bass Shake It Off Black widow Habits Bang Bang Don ' t tell ' Em Animals
Alice 4 5 1
Bob 5 5 4 4 2
John 2 1 5 4
David 3 3
Note: There is a total of 5 points, and an empty item indicates that the user has not heard the music and has not yet made a comment. At this point, you want to recommend some of the music that she might like to the user Alice :
1. find the closest user to Alice's "taste" Natural Description :  here the " taste " Similar reaction to the number is the score close. For example, Alice has a very high rating of all of the two songs on that Bass and habits (4 points and 5 points respectively), but does not like Bang Bang; it's not hard to see Bob's Bass and habits also expressed a preference (5 points and 4 points respectively), but the Bang Bang evaluation was low (only 2 points). So it's easy to see that Alice and Bob are actually closer, and Bob is Alice's nearest neighbor . Mathematical model :  of course, when users get up, we can not use the naked eye to find Alice's neighbor users, so to establish a mathematical model for the algorithm to automatically find Alice's neighbor users. There are actually many ways to measure whether the "taste" of two users is similar. If you think of each row in the table as a vector, this vector is used to represent user preferences, then you can use a variety of methods to measure the similarity of two user preferences, such as the cosine similarity, Pearson Similarity, and so on, here is only a brief introduction:cosine similarity:  the cos (U1,U2) indicates the similarity between user U1 and user U2;R is the evaluation matrix, Ru1,y represents the user u1 the music y score, ru2,y represents the user U2 to the music y score;the y in the molecule represents the intersection of the user U1 and the music that the user U2 to evaluate;The y in the denominator represents the respective scoring set of the user U1 and U2; 2. Use Alice's nearest neighbor to predict Alice's scoring valueWe can traverse all users, Alice calculates a similarity with everyone, and then sorts the similarity, selecting the top 10 most similar users as Alice's nearest neighbor. Using the 10 nearest neighbor user's scoring data to give Alice a recommendation, before introducing the recommendation algorithm, first mention the formula:among them, Predict (U,i) represents the user u to the music I score forecast value;U is the nearest neighbor user collection of user u;R is the evaluation matrix;3. Recommend music to Alice!

Sort the predictions for some of the music that Alice has never heard in the second step, choose the top 10 best music recommendations to Alice, and you are done!

Because it is the first time to end the recommendation algorithm, so there are inevitably errors in the text, you are welcome to correct me ~ I will also take a moment to update some of the recommended algorithm articles ~

A simple collaborative filtering recommendation algorithm

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.