Evaluation Metrics Information Retrieval
vector-searchvector-databaseretrieval-augmented-generationllm-frameworksweaviate-featuresfunction-callingevaluationweaviate-recipesPythongenerative-ai
Export
Evaluation metrics for Retrieval and Recommendation Systems
[38]
Requirement already satisfied: pytrec_eval in /opt/homebrew/lib/python3.11/site-packages (0.5)
[ ]
Precision and recall
Precision and recall are rank-unaware metrics.
=\frac{\text{Number of relevant items in K}}{\text{Total number of items in K}}$$ $$\text{Recall@K} = \frac{TP}{TP+FN} =\frac{\text{Number of relevant items in K}}{\text{Total number of relevant items}}$$[39]
{
"sweet pastry": {
"P_4": 0.5,
"recall_4": 0.6666666666666666
},
"suitable for lunch": {
"P_4": 0.5,
"recall_4": 0.5
},
"goes well with jam": {
"P_4": 0.25,
"recall_4": 0.3333333333333333
}
}
Mean Average Precision (MAP)
[40]
{
"sweet pastry": {
"map_cut_4": 0.8333333333333333
}
}
Note that pytrec_eval seems to average MAP across the number of relevant items. See, how the MAP@K value changes, when we add 'scone' to the list of relevant items?
[41]
{
"sweet pastry": {
"map_cut_4": 0.5555555555555555
}
}
Normalized Discounted Cumulative Gain (NDCG)
[43]
{
"goes well with jam": {
"ndcg_cut_4": 0.4672390440360399
}
}