2013-05-16 31 views
0

我正在嘗試一下mahout,並開始構建一切,並看看示例。我最感興趣的是協作過濾,所以我開始從BookCrossing數據集中找到推薦的例子。我設法讓所有的工作都能正常運行,樣本運行沒有錯誤。然而,outbput是這樣的:運行協作過濾的mahout示例:結果在哪裏?

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類型,只顯示結果統計信息中的一些數字。我應該看看其他地方嗎?這個推薦人不打算得到任何實際的建議嗎?

回答

1

您實際上並沒有提出建議,在這裏您只是進行評估。

Mahout in Action book(link)中的這個例子應該給你一個關於如何獲得建議的想法。

該示例僅向一位用戶請求推薦,在您的情況下,您將遍歷所有用戶並獲取每位用戶的建議,然後決定如何處理,例如將其輸出到文件。

此外,該示例並未使用數據模型構建器或推薦器構建器,但通過查看方法簽名來找出它並不困難。

+0

啊,很酷。那麼我很明顯對這個例子期望過高。 –

+0

是的,這是看錯的地方。在第17頁的示例中,建議最簡單。 –