This article is quoted from http://blog.csdn.net/fwing/article/details/4942886
Now the recommendation system is particularly hot. Amazon is the best thing to do.
Above is Amazon's book recommendation.
The famous collaborative filtering (collaborative filtering) algorithm is used.
Let's use a simple example to illustrate.
The following is a table of books purchased by a user.
|
Network |
Introduction to Algorithms |
Artificial intelligence |
Database system implementation |
Probability statistics |
GRE Glossary Handbook |
Xiao ming |
1 |
0 |
1 |
0 |
1 |
0 |
Xiao Zhang |
0 |
1 |
1 |
0 |
1 |
0 |
Xiao Li |
1 |
1 |
0 |
0 |
0 |
0 |
Xiao Wang |
0 |
0 |
0 |
0 |
1 |
1 |
The above 1 means purchase, 0 means no purchase.
So how do we give Xiao Ming to recommend books?
Let's take a look at the traditional collaborative filtering (collaborative filtering) that Amazon has done before.
First of all, according to the books that everyone buys, we can represent each user as a vector.
For example
V (xiaoming) =<1, 0, 1, 0, 1, 0>
V (Xiao Zhang) =<0, 1, 1, 0, 1, 0>
V (Xiao Li) =<1, 1, 0, 0, 0, 0>
V (Xiao Wang) =<0, 0, 0, 0, 1, 1>
Then, we make such assumptions, buy books and the habit of people like xiaoming, if the purchase of Xiao Ming did not buy books, then we think, Xiaoming is likely to buy this book.
As a result, the problem becomes the person who buys the book to be familiar with Xiaoming. When it comes to vectors and similarities, we naturally think of using cosine to measure similarity.
Throw a formula here for the forgotten children's shoes.
Next, let's try to figure it out.
Cos<v (Xiao Ming), V (Xiao Zhang) >=0.67
Cos<v (Xiaoming), V (Xiao Li) >=0.41
Cos<v (Xiao Ming), V (Xiao Wang) >=0.41
Hehe, then with Xiao Ming habits most like is the small Zhang.
Then, we found that Xiao Zhang bought the "Introduction to the algorithm", but Xiao Ming did not buy, so we give Xiaoming recommended "Introduction to the algorithm."
This approach looks good, so why is Amazon proposing another approach?
Take a look at Amazon's Item-to-item collaborative filtering system.
One day, an engineer in Amazon had a cramp in his head and accidentally took the table in the wrong direction. So it turned into the following look.
|
Xiao ming |
Xiao Zhang |
Xiao Li |
Xiao Wang |
Network |
1 |
0 |
1 |
0 |
Introduction to Algorithms |
0 |
1 |
1 |
0 |
Artificial intelligence |
1 |
1 |
0 |
0 |
Database system implementation |
0 |
0 |
0 |
0 |
Probability statistics |
0 |
1 |
0 |
1 |
GRE Glossary Handbook |
0 |
0 |
0 |
1 |
If the line of the book is seen as a vector, what do you find? Yes, we can find similar people, we can also find similar books!!!
This is Amazon's Item-to-item collaborative filtering system.
Most of the time, innovation is so simple, write paper is so easy ah, another way to think (er, that kid's shoes, not to tell you to take the book counter-see).
Here is a brief description of the method.
We can figure out the similarity between any two items (similar to the one above).
Next we see Xiao Ming bought "computer network" and "Artificial Intelligence" book, the two books similar to the book recommended to Xiao Ming.
The most similar to "Computer network" is the "Introduction to Algorithms" and "artificial Intelligence", and "AI" is the most similar to the "Computer network" and "Algorithm introduction."
The final result is the ^_^ of the introduction to algorithms.
With this method, we can recommend to the user that the user who bought the product also bought * * *
Does this method have any merit? (nonsense, or Amazon will use it, the businessman is very smart)
Tradition VS Amazon
Amazon's CF algorithm can calculate the similarity between item in offline situations. When a user logs in, we only need to check the user's purchase history, and then the item similar to these item according to a certain method (such as popularity) in order to show the user. In general, a user buys something that is only a small collection, so it does not take a lot of time to calculate.
Furthermore, if the user does not log in, we can still make recommendations based on his browsing history. For example, the picture above is that I looked at "Beautiful Architecture" without landing, and Amazon recommended it to me.
For websites like Amazon, the amount of users is far greater than the number of items. As a result, Amazon's CF algorithm, which calculates the similarity of goods, greatly saves resources compared to the traditional CF algorithm (computing user similarity).
For a user who is not logged in, the traditional CF algorithm has no way of recommending it according to his browsing history (it is obviously impossible to calculate the similarity of one user to all other users online).
Amazon's Referral system