I should have thought of this and CC'ed the list before, but, thought
of it after the fact. I wanted to forward this thread to the list
since the answer might be of use. Will forward the reply next...


---------- Forwarded message ----------
From: 郑楠 <[email protected]>
Date: Mon, Apr 13, 2009 at 11:52 AM
Subject: problems with taste
To: Sean Owen <[email protected]>


Hello,Sean Owen
        Recently I have a problem with taste.
I want to use two models to complete the process of recommendation,
like the coding below: I use "model"(m*k Matrix) to compute the
similarity between users, and use "modelPaper"(m*n Matrix, where k<n)
and the similarity results computed in the first step to predict
recommendation. I imitated the class "NetflixDataModel" to write two
similar classes "CiteulikeDataModel" and "CiteulikePaperDataModel".
The following is my recommendation code:
          DataModel model = new CiteulikeDataModel(new File("sample1"));
DataModel modelPaper = new CiteulikePaperDataModel(new File("sample2"));
UserSimilarity userSimilarity = new SpearmanCorrelationSimilarity(model);
userSimilarity.setPreferenceInferrer(new AveragingPreferenceInferrer(model));
int neighbor=1;
UserNeighborhood neighborhood = new NearestNUserNeighborhood(neighbor,
userSimilarity, model);
Recommender recommender = new GenericUserBasedRecommender(modelPaper,
neighborhood, userSimilarity);
Recommender cachingRecommender = new CachingRecommender(recommender);
for(int i=0;i<5;i++){//user number is 5 here
List<RecommendedItem> recommendations = cachingRecommender
.recommend(i+"", 4);//recommend 4 items to each user
for (RecommendedItem recommendedItem : recommendations) {
System.out.println(recommendedItem.getItem());
}
                }
By checking the results, I find that the similarity is computed based
on "model", and the recommendation part is based on the appearance of
items in "modelPaper", but it only recommender the first k items to
each user and the recommended item is the element in "model". I cannot
find the problem.
Here is my test data.
the data used to build model is (5*6)
1,b,10
1,e,8
2,a,60
2,d,12
3,b,15
3,e,10
3,f,2
4,a,59
4,d,10
4,f,1
5,a,2
5,d,5
5,f,3
the data used to build modelPaper is (5*10)
1,aa,1
1,bb,1
1,cc,1
2,aa,1
2,bb,1
2,cc,1
2,dd,1
2,ee,1
3,bb,1
3,dd,1
3,ee,1
3,ff,1
3,gg,1
4,bb,1
4,ee,1
4,ff,1
4,ii,1
4,jj,1
5,aa,1
5,bb,1
5,cc,1
5,dd,1
5,ee,1
5,ff,1
5,gg,1
5,hh,1
the result:
user1
4:e
5:f
user2
5:f
user3
user4
0:a
3:d
user5
Can you give me some advice? Thanks a lot!
Best wished!
Alice

Reply via email to