mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark <static.void....@gmail.com>
Subject Re: PlusAnonymousUserDataModel
Date Tue, 15 Mar 2011 23:22:48 GMT
I'm going crazy over here!

Can someone please show me an example of a offering up anonymous 
recommendations using a GenericBooleanPrefItemBasedRecommender and 
LogLikelihoodSimilarity. I keep getting 0 results even though I set the 
anonymous users preferences to the same as one of my test users which 
receives multiple recommendations.

public static void main(String[] args) throws IOException, TasteException {
     DataModel realModel = new FileDataModel(new 
File("/usr/local/recommendations/dummy.data"));
     PlusAnonymousUserDataModel plusModel = new 
PlusAnonymousUserDataModel(realModel);

     ItemSimilarity similarity = new LogLikelihoodSimilarity(realModel);

     Recommender recommender = new 
GenericBooleanPrefItemBasedRecommender(plusModel, similarity);

     PreferenceArray anonymousPrefs = new GenericItemPreferenceArray(3);
     anonymousPrefs.setItemID(0, 1);
     anonymousPrefs.setUserID(0, PlusAnonymousUserDataModel.TEMP_USER_ID);
     anonymousPrefs.setItemID(1, 2);
     anonymousPrefs.setUserID(2, PlusAnonymousUserDataModel.TEMP_USER_ID);
     anonymousPrefs.setItemID(2, 4);
     anonymousPrefs.setUserID(2, PlusAnonymousUserDataModel.TEMP_USER_ID);

     plusModel.setTempPrefs(anonymousPrefs);
     List<RecommendedItem> items = 
recommender.recommend(PlusAnonymousUserDataModel.TEMP_USER_ID, 10);
     plusModel.clearTempPrefs();

     for (RecommendedItem item : items) {
       System.out.println(item);
     }
   }

On 3/15/11 1:30 PM, Sean Owen wrote:
> Yes, should be fine.
>
> On Tue, Mar 15, 2011 at 6:59 PM, Mark<static.void.dev@gmail.com>  wrote:
>> One last question. Will PlusAnonymousUserDataModel work with
>> BooleanPreferences?

Mime
View raw message