0

我正在尝试使用 mahout 并开始构建所有内容并查看示例。我最感兴趣的是协同过滤,所以我从从 BookCrossing 数据集中查找推荐的示例开始。我设法让一切正常运行,示例运行没有错误。但是,输出是这样的:

INFO: Creating FileDataModel for file /tmp/taste.bookcrossing.
INFO: Reading file info...
INFO: Read lines: 433647
INFO: Processed 10000 users
INFO: Processed 20000 users
INFO: Processed 30000 users
INFO: Processed 40000 users
INFO: Processed 50000 users
INFO: Processed 60000 users
INFO: Processed 70000 users
INFO: Processed 77799 users
INFO: Beginning evaluation using 0.9 of BookCrossingDataModel
INFO: Processed 10000 users
INFO: Processed 20000 users
INFO: Processed 22090 users
INFO: Beginning evaluation of 4245 users
INFO: Starting timing of 4245 tasks in 2 threads
INFO: Average time per recommendation: 296ms
INFO: Approximate memory used: 115MB / 167MB
INFO: Unable to recommend in 1 cases
INFO: Average time per recommendation: 67ms
INFO: Approximate memory used: 107MB / 167MB
INFO: Unable to recommend in 2363 cases
INFO: Average time per recommendation: 72ms
INFO: Approximate memory used: 146MB / 167MB
INFO: Unable to recommend in 5095 cases
INFO: Average time per recommendation: 71ms
INFO: Approximate memory used: 113MB / 167MB
INFO: Unable to recommend in 7596 cases
INFO: Average time per recommendation: 71ms
INFO: Approximate memory used: 130MB / 167MB
INFO: Unable to recommend in 10896 cases
INFO: Evaluation result: 1.0895580110095793

当我检查代码时,我可以看到它是这样做的:

RecommenderIRStatsEvaluator evaluator = new GenericRecommenderIRStatsEvaluator();
File ratingsFile = TasteOptionParser.getRatings(args);
DataModel model =
    ratingsFile == null ? new BookCrossingDataModel(true) : new BookCrossingDataModel(ratingsFile, true);

IRStatistics evaluation = evaluator.evaluate(
    new BookCrossingBooleanRecommenderBuilder(),
    new BookCrossingDataModelBuilder(),
    model,
    null,
    3,
    Double.NEGATIVE_INFINITY,
    1.0);

log.info(String.valueOf(evaluation));

所以这似乎是正确的,但我想从生成的建议和/或相似性中看到更多细节。返回的对象是 IRStatistics 类型,它仅公开结果统计信息中的一些数字。我应该看看别的地方吗?这个推荐器不是为了获得任何实际推荐吗?

4

1 回答 1

1

You are not actually generating recommendations, here you are just performing an evaluation.

This example from the Mahout in Action book (link) should give you an idea on how to actually get recommendations.

The example only requests recommendations for one user, in your case you would iterate through all the users and get every users recommendations, then you decide what to do with that, like output them to a file.

Also the example doesn't use the data model builder or the recommender builder, but it shouldn't be hard for you to figure it out by looking at the method signatures.

于 2013-05-16T11:24:08.917 回答