mahout (specfying、offset、および max result) を使用してページネーションを実装したかったのですが、Mahout でそれを実現するにはどうすればよいですか? レコメンデーションを生成するこのコードがあるとしましょう
File ratingsFile = new File("audio-dummy-bool.csv");
DataModel model = new FileDataModel(ratingsFile);
CachingRecommender cachingRecommender2 = new CachingRecommender(new SlopeOneRecommender(model));
// for all users
for (LongPrimitiveIterator it = model.getUserIDs(); it.hasNext();){
long userId = it.nextLong();
// get the recommendations for the user
List<RecommendedItem> recommendations = cachingRecommender.recommend(userId, 10);
// if empty write something
if (recommendations.size() == 0){
System.out.print("User ");
System.out.print(userId);
System.out.println(": no recommendations");
}
// print the list of recommendations for each
for (RecommendedItem recommendedItem : recommendations) {
System.out.print("User ");
System.out.print(userId);
System.out.print(": ");
System.out.println(recommendedItem);
}
}
レコメンデーションはユーザーに対して何千もの結果を生成する可能性があり、メモリを大量に消費する可能性があるため、このためにページネーションを実装したかったのです。とにかく、マハウトで生成の推奨事項の最大結果とオフセットを指定できますか?