Http://terryma.blog.sohu.com/58889892.html
I am ashamed to pay attention to the recommendation system for a long time and have no output.
I have learned about the open-source Java recommendation system taste over the past few days. I have some experiences and I will post it slowly.
If the item-based recommendation is generated:
Assume that there are four users: u1, U2, U3, and U4.
Product has n C1, C2, C3
Steps:
1. Find out the user's score for the product.
2. Identify similarity between products.
3. Users can be recommended.
What needs to be done manually is to rate the similarity between products. This is a very troublesome task. If there are n products, we need n! .
If taste is used for implementation, the required code is as follows:
1. Create a dataset. The main data content is the user's score on the product:
DataModel model = new FileDataModel(new File("data.txt")); 2. Establish item similarity and set For example, create a thing first (three items are available here) Final item Item1 = new genericitem <string> ("0 "); Final item item2 = new genericitem <string> ("1 "); Final item item3 = new genericitem <string> ("2"); Record item Similarity Final collection <genericitemcorrelation. itemitemcorrelation> correlations = New arraylist <genericitemcorrelation. itemitemcorrelation> (2 ); Correlations. Add (New genericitemcorrelation. itemitemcorrelation (Item1, Item1, 1.0 )); Correlations. Add (New genericitemcorrelation. itemitemcorrelation (Item1, item3, 0.5 )); 3. generate recommendations Final itemcorrelation correlation = new genericitemcorrelation (correlations ); Final recommender = genericitembasedrecommender (datamodel, correlation ); 4. Final recommendation generation Final list <recommendeditem> recommended = recommender. Recommend ("test1", 1 ); Final recommendeditem firstrecommended = recommended. Get (0 ); |