Recommendation is required for a project. Algorithm I checked it online. beyond Search introduces a collaborative filtering algorithm: slope one. Compared with other similar algorithms, beyond search has the following advantages: it is simple, easy to implement, and highly efficient to execute, at the same time, the recommendation accuracy is relatively high;
Basic Concepts
The basic concept of slope one is very simple. In example 1, users X, Y, and a all score Item1. at the same time, user X and Y have scored item2. How many points does user a have for item2?
| User |
rating to item 1 |
rating to item 2 |
| x |
5 |
3 |
| Y |
4 |
3 |
| A |
4 |
? |
According to the slopeone algorithm, it should be: 4-(5-3) + (4-2)/2 = 2.5.
Let's explain. user X's rating to Item1 is 5 and the rating to item2 is 3, so he may think item2 should be two points less than Item1. meanwhile, user y thinks item2 should be 1 point less than Item1. based on this, we know that all users who score Item1 and item2 think that item2 will be 1.5 points less on average than Item1. therefore, we recommend that user a (4-1.5) = 2.5 points for item2;
It's easy, isn't it? Find the users who have been playing too much for Item1 and item2, and calculate the average value of the rating difference. In this way, we can infer the possibility of rating for item2 by user a who has been playing too much for Item1, recommend a new project to user a accordingly.
Here we can see that the slope one algorithm has a great advantage, and can get a relatively accurate recommendation when there is only a small amount of data, which can solve the problem of cold start.
Weighting Algorithm
Next we will look at the weighted algorithm (weighted slope one ). if there are 100 users over-beat Item1 and item2, 1000 users over-beat item3 and item2. obviously, the weights of the two rating differences are different. therefore, our calculation method is
(100 * (rating 1 to 2) + 1000 (rating 3 to 2)/(100 + 1000)
The above discussion shows that users only rate project preferences. in other cases, the user can also score the degree of dislike of the project. you can use the bipolar slopeone algorithm (bi-polar slopeone ). I am still studying this paper. I can understand it and write it again;
references
Professor Daniel lemire proposed the slope one algorithm in 2005. here we can find the original article (PDF); The above also lists several Reference implementations. now there are python, Java and Erlang, and there is no C #.
this article: tutorial about how to implement slope one in python is a good example of how to implement slopeone and use it for recommendation. but it seems that I cannot access it now:-(refer to the Article , in the next article, I will use C # Code to explain how to implement weighted slope one.