guoguibing/librec

Save result for each fold (kcv or loocv) in version 3.0.0

Opened this issue · 0 comments

Hi all,
Thanks for your all amazing job on librec.

I noticed that, compared with the version 2.0.0, version 3.0.0 has changed the behaviour in RecommenderJob#executeRecommenderJob().

More precisely, in ver 2.0.0, the result for each cv fold would be saved while in ver 3.0.0 only the last one is saved.

My questions are:

  1. I was wondering if this is a new feature? If so, could you refine the document/changelog to specify it?
  2. Would it be reasonable if I want to save each result:

in executeRecommenderJob()

int fold = 1; 
while (dataModel.hasNextFold()) {
    dataModel.nextFold();
    context.setDataModel(dataModel);
    generateSimilarity(context);
    recommender.train(context);
    executeEvaluator(recommender, context);
    // specify cv index
    conf.setInt("data.splitter.cv.index", fold++);
    // move from the outside of the while loop
    boolean isRanking = conf.getBoolean("rec.recommender.isranking");
    List<RecommendedItem> recommendedList;
    if (isRanking) {
        recommendedList = recommender.getRecommendedList(recommender.recommendRank());
    } else {
        recommendedList = recommender.getRecommendedList(recommender.recommendRating(context.getDataModel().getTestDataSet()));
    }
    recommendedList = filterResult(recommendedList);
    saveResult(recommendedList);
}