简体   繁体   English

Mahout-运行als-wr推荐器评估程序

[英]Mahout - run als-wr recommender evaluator

I'm trying to get the precision and recall of the als-wr algorithm on my input using mahout. 我试图使用mahout在输入中获得als-wr算法的精度和召回率。

The problem is the only way I've found to use als-wr algorithm is from mahout command line - https://mahout.apache.org/users/recommender/intro-als-hadoop.html 问题是,我发现使用ALS-WR算法的唯一途径是从象夫命令行- https://mahout.apache.org/users/recommender/intro-als-hadoop.html

I don't see any example in web for using this algorithm in code. 我在网络上看不到任何在代码中使用此算法的示例。

Any example or help for running it in scala/java with an evaluator will be strongly appreciated. 非常感谢在评估器中使用scala / java运行它的任何示例或帮助。

    RecommenderIRStatsEvaluator user_eval = new GenericRecommenderIRStatsEvaluator();
    RecommenderBuilder user_rb = new RecommenderBuilder() 
    {
    @Override
        public Recommender buildRecommender(DataModel model) throws TasteException 
        {
            UserSimilarity user_ll_sim = new LogLikelihoodSimilarity(model);
            UserNeighborhood user_ll_nbhd = new NearestNUserNeighborhood(5, user_ll_sim, model);
            return new GenericUserBasedRecommender(model, user_ll_nbhd, user_ll_sim);
        }
    };

    IRStatistics user_ll_stats = user_eval.evaluate(user_ll_rb, null, model, null, 2, GenericRecommenderIRStatsEvaluator.CHOOSE_THRESHOLD, 0.8);
    System.out.println(user_ll_stats.getPrecision()+" "+user_ll_stats.getRecall());

Replace the User Based LogLikelihood model with the SVD one. 用SVD替换基于用户的LogLikelihood模型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM