推荐系统评价指标
1. Precision 精度 intersectionSize / numRecommendedItems
2. Recall 召回率 intersectionSize / numRelevantItems
3. Fall-out (numRecommendedItems - intersectionSize)/(numItems - numRelevantItems)
4. nDCG
double cumulativeGain = 0.0;
double idealizedGain = 0.0;
for (int i = 0; i < recommendedItems.size(); i++) {
RecommendedItem item = recommendedItems.get(i);
double discount = i == 0 ? 1.0 : 1.0 / log2(i + 1);
if (relevantItemIDs.contains(item.getItemID())) {
cumulativeGain += discount;
}
// otherwise we're multiplying discount by relevance 0 so it doesn't do anything
// Ideally results would be ordered with all relevant ones first, so this theoretical
// ideal list starts with number of relevant items equal to the total number of relevant items
if (i < relevantItemIDs.size()) {
idealizedGain += discount;
}
}
nDCG.addDatum(cumulativeGain / idealizedGain);
In computing, assume relevant IDs have relevance 1 and others 0