guoguibing / librec

LibRec: A Leading Java Library for Recommender Systems, see
https://www.librec.net/
Other
3.24k stars 1.03k forks source link

Normalized DCG Evaluator is always 1.0 #269

Open riccardomulas opened 6 years ago

riccardomulas commented 6 years ago

Hi. I'm testing the library on different datasets and every time I execute a Recommender, the evaluation with normalized DCG returns 1.0. I tried with different datasets and recommenders, paying attention to the configuration, but I can't figure out where is the error. Is it possible that there is some bug in the class NormalizedDCGEvaluator? In the doc there are no examples about this evaluator and I don't know how to fix this. The snippet of the code is the following:

conf.set("rec.recommender.similarities","item");
conf.set("rec.recommender.isranking", "true");
conf.set("rec.eval.enable", "true");
conf.set("rec.eval.class", "ndcg");
conf.set("rec.recommender.ranking.topn", "10");
conf.set("rec.recommender.class", "itemknn");
conf.set("rec.similarity,shrinkage", "10");
conf.set("rec.neighbors.knn.number", "50");

Recommender recommender = new ItemKNNRecommender();
recommender.recommend(context);

RecommenderEvaluator normDCGE = new NormalizedDCGEvaluator();
//normDCGE.setTopN(10);
double dcge = recommender.evaluate(normDCGE);
System.out.println("Normalized DCGE:" + dcge);
SunYatong commented 6 years ago

Does this happen with the built-in filmtrust and ml-100k datasets? I can't reproduce your problem with these two datasets.

BTW in your configuration:

conf.set("rec.similarity,shrinkage", "10");

the "," should be replaced with "." .