用于用户用户协同过滤的模型创建 [英] Model creation for User User collanborative filtering

查看:134
本文介绍了用于用户用户协同过滤的模型创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想进行某种用户-用户协作过滤,其中用户项矩阵中的用户是数据库中整个用户的选定部分.这些选定的用户会定期使用新选定的用户首选项进行刷新.新用户不应添加到矩阵中.对于新用户,根据他的喜好,我们需要从用户项目矩阵(仅选择一部分用户)中推荐项目.我不想将新的匿名用户添加到矩阵中.

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.

在Mahout中探索,但在那里需要一些帮助. Mahout中的Recommender类具有Recommendation(...)方法,该方法将user_id作为参数.这不是我想要的.该方法应接受首选项,并应基于模型推荐项目.在Mahout中如何做?我们可以使用PlusAnonymousUserDataModel吗?

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 ??

如果不是mahout,还有哪些其他工具可以完成此任务...

If not mahout, what other tools can accomplish this...

我与PlusAnonymousUserDataModel一起使用的代码不会为具有正常使用建议的用户提供任何建议.

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);

代码是否有问题?

推荐答案

sravan_kumar,如果在3个地方用plusAnonymousModel替换model:
TanimotoCoefficientSimilarity相似度=新的TanimotoCoefficientSimilarity(plusAnonymousModel);
UserNeighborhood邻域=新的NearestNUserNeighborhood(1000,相似度,加上AnonymousModel);
推荐荐荐者1 =新的GenericBooleanPrefUserBasedRecommender(plusAnonymousModel,邻域,相似性);

sravan_kumar, if you replace model with plusAnonymousModel in 3 places:
TanimotoCoefficientSimilarity similarity = new TanimotoCoefficientSimilarity(plusAnonymousModel);
UserNeighborhood neighborhood = new NearestNUserNeighborhood(1000, similarity, plusAnonymousModel);
Recommender recommender1 = new GenericBooleanPrefUserBasedRecommender(plusAnonymousModel, neighborhood, similarity);

并在初始化模型后立即初始化plusAnonymousModel:
PlusAnonymousUserDataModel plusAnonymousModel =新的PlusAnonymousUserDataModel(model);
(在使用时,无需使用plusmodel变量)
,您将获得理想的结果!

and initialize plusAnonymousModel right, just after initializing model:
PlusAnonymousUserDataModel plusAnonymousModel = new PlusAnonymousUserDataModel(model);
(there is no need in plusmodel variable, as you use it)
, you will get the desired results!

此外,将GenericUserPreferenceArray更改为BooleanUserPreferenceArray:)

这篇关于用于用户用户协同过滤的模型创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆