guoguibing / librec

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

Getting raw user id from testMatrix in NormalizedDCGEvaluator #298

Closed filipefbn closed 5 years ago

filipefbn commented 5 years ago

Hi, I'm trying to obtain the individual NDCG values for each user in the test set. I have modified the NormalizedDCGEvaluator file so that I can write the values to a file. However, I can't seem to get the raw IDs (if I understood correctly, the userID variable in the evaluate method is related to the testMatrix indexes). Ideally, my file would look like:

\<rawUserID>,\<NDCG> \<rawUserID>,\<NDCG> ... \<rawUserID>,\<NDCG>

Is there any way I can do this by modifying the NormalizedDCGEvaluator ?

SunYatong commented 5 years ago

The original NDCGEvaluator calculates the average NDCG of all users, all you need to do is to transform the userMappingData from Recommender to the Evaluator, which contains the user id-index mappings.

filipefbn commented 5 years ago

I managed to pass the userMappingData to the Evaluator and it worked. Thanks a lot!