I want to do a sort of user-user collaborative filtering wherein the users in the user-item matrix are a selected part of whole users in the database. These selected users are refreshed regularly with newly selected users preferences. New users shouldn't be added to the matrix. For a new user, based on his preferences we need to recommend items from the user-item matrix (which has only a part of users which are selected). I do not want to add the new anonymous users to the matrix.
Explored in Mahout, but need some help there. The Recommender Class in Mahout has recommend(...) method which takes the user_id as argument. This is not which I want. The method should accept the preferences and based on the model , items should be recommended. How to do it in Mahout?? Can we use PlusAnonymousUserDataModel ??
If not mahout, what other tools can accomplish this...
The code which I used with PlusAnonymousUserDataModel which is not giving any recommendations for the user who has recommendations with normal usage..
DataModel model = new GenericBooleanPrefDataModel( GenericBooleanPrefDataModel.toDataMap( new FileDataModel(f)));
TanimotoCoefficientSimilarity similarity = new TanimotoCoefficientSimilarity(model);
UserNeighborhood neighborhood = new NearestNUserNeighborhood(1000, similarity, model);
new_user_preferences = { ... } // new user items..
DataModel plusmodel = new PlusAnonymousUserDataModel(model);
PreferenceArray anonymousPrefs = new GenericUserPreferenceArray(new_user_preference.length);
anonymousPrefs.setUserID(0, PlusAnonymousUserDataModel.TEMP_USER_ID);
for(int i = 0;i < new_user_preference.length;i++)
{
anonymousPrefs.setItemID(i, new_user_preference[i]);
}
PlusAnonymousUserDataModel plusAnonymousModel = (PlusAnonymousUserDataModel) plusmodel;
Recommender recommender1 = new GenericBooleanPrefUserBasedRecommender(model, neighborhood, similarity);
plusAnonymousModel.setTempPrefs(anonymousPrefs);
List<RecommendedItem> recommendations1 = recommender1.recommend(plusAnonymousModel.TEMP_USER_ID, 10);
Is there any problem with the code??