User-based recommendations and item-based recommendations
The two algorithms depend on the similarity measurement (same-sex definition) between two things (users or items). The similarity measurement method is pearsoncorrealation Pearson correlation coefficient and the log likelihood value loglikelihood, the Pearson correlation coefficient is short mancorrelation, and the grain coefficient is tanimotocoefficient.
Recommendation algorithm: slope-one, based on SVD and clustering recommendation algorithm.
User-based recommendations:
Sample Code:
Public static void main (string [] ARGs) throws exception {// load data files for storage and provide all the preferences required for computing, user and item data datamodel model = new filedatamodel (new file ("Data/intro.csv"); // user similarity, which gives the similarity between two users and has multiple measurement methods, it encapsulates the concept of user similarity usersimilarity similarity = new pearsoncorrelationsimilarity (model); // user neighbor, a group of users most similar to a given user, encapsulates the concept of the most similar user group userneighborhood neighborhood = new feature (2, similarity, model); // The recommendation engine merges these components to recommend recommender = new genericuserbasedrecommender (model, neighborhood, similarity); // recommended item 1, 1, and list for user 1 <recommendeditem> recommendeditems = recommender. recommend (1, 1); // output for (recommendeditem item: recommendeditems) {system. out. println (item );}}
When a new similarity measure is introduced, the results will change significantly. Mahout recommendation is composed of multiple components, rather than a single recommendation engine. The combination of other components can be customized to provide ideal recommendations for specific applications.
1. Data Model with datamodel implementation
2. User similarity measurement, implemented by usersimilarity
3. User neighbor definition, with userneighborhood implementation
4. recommendation engine, implemented by a recommender (genericuserbasedrecommender here)