首页 > 代码库 > mahout学习(三)

mahout学习(三)

public class TMahout03 {    public static void main(String[] args) throws IOException, TasteException {        //-准确率和召回率评估的配置与运行-//       
        RandomUtils.useTestSeed(); DataModel model
= new FileDataModel(new File("path/ua.base")); RecommenderIRStatsEvaluator irStatsEvaluator = new GenericRecommenderIRStatsEvaluator(); RecommenderBuilder recommenderBuilder = new RecommenderBuilder() { @Override public Recommender buildRecommender(DataModel model) throws TasteException { UserSimilarity similarity = new PearsonCorrelationSimilarity(model); UserNeighborhood neighborhood = new NearestNUserNeighborhood(2, similarity, model); return new GenericUserBasedRecommender(model, neighborhood, similarity); } }; IRStatistics stats = irStatsEvaluator.evaluate(recommenderBuilder, null, model, null, 2, GenericRecommenderIRStatsEvaluator.CHOOSE_THRESHOLD,1.0); System.out.println(stats.getPrecision()); System.out.println(stats.getRecall()); }}

//SlopeOneRecommender  @Deprecated。
1 February 2014 - Apache Mahout 0.9 released Apache Mahout has reached version 0.9. All developers are encouraged to begin using version 0.9. Highlights include:     New and improved Mahout website based on Apache CMS - MAHOUT-1245    Early implementation of a Multi Layer Perceptron (MLP) classifier - MAHOUT-1265    Scala DSL Bindings for Mahout Math Linear Algebra. See this blogpost and MAHOUT-1297    Recommenders as Search. See [https://github.com/pferrel/solr-recommender] and MAHOUT-1288    Support for easy functional Matrix views and derivatives - MAHOUT-1300    JSON output format for ClusterDumper - MAHOUT-1343    Enabled randomised testing for all Mahout modules using Carrot RandomizedRunner - MAHOUT-1345    Online Algorithm for computing accurate Quantiles using 1-dimensional Clustering - See this pdf and MAHOUT-1361    Upgrade to Lucene 4.6.1 - MAHOUT-1364 Changes in 0.9 are detailed in the release notes. The following algorithms that were marked deprecated in 0.8 have been removed in 0.9:     Switched LDA implementation from Gibbs Sampling to Collapsed Variational Bayes    Meanshift - removed due to lack of actual usage and support    MinHash - removed due to lack of actual usage and support    Winnow - removed due to lack of actual usage and support    Perceptron - removed due to lack of actual usage and support<span style="color: #ff6600;"><strong>    Slope One - removed due to lack of actual usage</strong></span>    Distributed Pseudo recommender - removed due to lack of actual usage    TreeClusteringRecommender - removed due to lack of actual usage

 

 

 

mahout学习(三)