I am experimenting a bit with mahout and started building everything and have a look at the examples. I am mostly interested in collaborative filtering, so I started with the example on finding recomendations from the BookCrossing dataset. I managed to get everything working, the sample runs without errors. However, the outbput is something like this:
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
When I check the code, I can see that is does this:
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));
So that seems to be correct, but I would like to see more details from the generated suggestions and/or similarities. The object returned is of type IRStatistics, which exposes only some numbers on the statistics of the results. Should I look somewhere else? Is this recommender not intended for getting any actual recommendations?
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.