Recommendation algorithms in Mahout include User-based Recommender, Item-based Recommender, and Slope-One Recommender.
1. User-based Recommender
The main idea of this algorithm is: the product most similar to user u is probably the product that user u prefers.
1. for each product of user u without preference i2 for each user of user v3 with preference for product I, the similarity s between user u and v is calculated. // In fact, online computing is not required, it can be calculated and stored in advance. 4. Multiply the preference of user v for product I by s, the average value of the preference added to user u's prediction of commodity I is 5, which returns several items with the highest average value of user u as the recommended commodity.
The above algorithms need to enumerate every commodity I, resulting in very slow computing. It can calculate all the neighbors of a user u (as set n), and then, when making recommendations for user u, the algorithm is as follows:
1. For each other user w2, calculate the similarity between user u and user w. s3 returns several users with the highest similarity of user u, the preceding steps can be performed offline, similar to index 5, which has no preference for each u of the user u, however, in the neighbor n of u, a user's preference item i6 calculates the similarity between user u and v for each user's neighbor v7 of u who has preference to item I. // In fact, online computing is not required, you can calculate the preference value of user v for commodity I in advance, multiply it by s, and add it to the average value of user u's preference value for commodity I.
2. Item-based Recommender
The main idea of this algorithm is: users who like commodity I, u, are likely to like other products that are similar to commodity I.
1. For each item of user U without preference I2 for each item of user u with preference J3 calculate similarity between product I and j S4 multiply preference of user u to product j by S, the average value of the preference added to the user u to the commodity I is 5 and returns the items with the highest average value of the user U as the recommended item.
3. Slope-one recommender
Calculate the average value of the preference difference between two commodities.
1. For a product I2 for a product J3 for users with preference for each product I and J, U4 adds the preference value of user U for product I and J to all users for Product remove from the average of the difference between I and commodity J
Recommendation
1. for each product without preference of user U, I2 for each product with preference of user U, J3 obtains the average value of preference difference between product I and product j, diff4 adds diff and u to product j. and add user u to the preference average of commodity I, go to 5 and return the items with the highest preference predicted by user U as a recommendation.
[1] mahout in action