Reputation: 311
I have implemented a basic user based recommandation system but when I run the program there are a lot of users(in output) who have not any recommended item.
I thought that it could be due to my datamodel if there is single item for this user but there are multiple item for that user.
What is the mistake i am doing ?
My code is like this -
DataModel dm =new FileDataModel(new File("data.csv"));
UserSimilarity similarity =new PearsonCorrelationSimilarity(dm);
UserNeighborhood neighborhood = new ThresholdUserNeighborhood(0.1, similarity, dm);
UserBasedRecommender recommander= new GenericUserBasedRecommender(dm,neighborhood,similarity);
for(LongPrimitiveIterator users=dm.getUserIDs(); users.hasNext();)
{
Long UserID=users.nextLong();
List<RecommendedItem>recommendations = recommander.recommend(UserID,10000);
for(RecommendedItem recommendation : recommendations)
{
System.out.println(recommendation);
}
}
And my datamodel format is -(userID, ItemID, preference)
like-
25417,11114,1
25417,11114,1
25669,11114,1
25333,11114,1
26426,11114,1
26427,11114,1
25432,11114,1
26432,11114,1
26432,11114,1
13720603,116608,1
13720602,204167,1
13720602,198158,1
13720604,6584,1
13720605,3124,1
217778,76263,2
13720606,5199,1
13720607,63613,1
217778,49443,1
13720608,118189,1
13361003,65759,2
13361003,65759,2
13673094,19002,1
13720609,3284,2
13720610,167130,1
13720611,211780,1
13720611,211780,1
13720612,62397,1
13720613,62397,1
13720614,60860,1
13720613,62397,1
13720615,108533,1
Please help. I am unable to find out the problem.
Upvotes: 0
Views: 112
Reputation: 5702
User and item ids must be turned into non-negative ints so they correspond to row and column numbers of the dataset. This means you need to create dictionaries to transform your application specific ids into and out of Mahout IDs.
BTW there is a newer better recommender architecture from Mahout here (it will use your application specific IDs):
Upvotes: 1