ユーザー-アイテムマトリックス内のユーザーがデータベース内のユーザー全体の選択された部分である、一種のユーザー-ユーザー協調フィルタリングを実行したいと思います。これらの選択されたユーザーは、新しく選択されたユーザー設定で定期的に更新されます。新しいユーザーをマトリックスに追加しないでください。新規ユーザーの場合、ユーザーの好みに基づいて、ユーザーアイテムマトリックス(選択されたユーザーの一部のみを含む)からアイテムを推奨する必要があります。新しい匿名ユーザーをマトリックスに追加したくありません。
マハウトで探索しましたが、そこで助けが必要です。MahoutのRecommenderクラスには、user_idを引数として取るrecommend(...)メソッドがあります。これは私が望むものではありません。メソッドは設定を受け入れる必要があり、モデルに基づいて、アイテムが推奨される必要があります。マハウトでそれを行う方法は?? PlusAnonymousUserDataModelを使用できますか??
mahoutでない場合、他のどのツールがこれを達成できるか...
PlusAnonymousUserDataModelで使用したコードで、通常の使用法で推奨事項があるユーザーに推奨事項を提供していません。
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);
コードに問題はありますか?