lenskit.metrics.ranking#
LensKit ranking (and list) metrics.
Classes#
Base class for most ranking metrics, implementing an |
|
Compute the _unnormalized_ discounted cumulative gain [JarvelinKekalainen02]. |
|
Compute the normalized discounted cumulative gain [JarvelinKekalainen02]. |
|
Evaluate diversity using Shannon entropy over item categories. |
|
Evaluate diversity using rank-biased Shannon entropy over item categories. |
|
Measure exposure distribution of recommendations with the Gini coefficient. |
|
Measure item diversity of recommendations with the Gini coefficient. |
|
Compute whether or not a list is a hit; any list with at least one |
|
Evaluate recommendation diversity using intra-list similarity (ILS). |
|
Compute Average Precision (AP) for a single user's recommendations. This is |
|
Compute the _obscurity_ (mean popularity rank) of the recommendations. |
|
Compute recommendation precision. This is computed as: |
|
Compute recommendation recall. This is computed as: |
|
Evaluate recommendations with rank-biased precision [MZ08]. |
|
Compute the reciprocal rank [KV97] of the first relevant |
|
Geometric cascade weighting for result ranks. |
|
Logarithmic weighting for result ranks, as used in NDCG. |
|
Base class for rank weighting models. |
Functions#
|
Compute rank-biased precision given explicit weights. |
Package Contents#
- lenskit.metrics.ranking.rank_biased_precision(good, weights, normalization=1.0)#
Compute rank-biased precision given explicit weights.
- Parameters:
good (numpy.ndarray) – Boolean array indicating relevant items at each position.
weights (numpy.ndarray) – Weight for each item position (same length as good).
normalization (float) – Optional normalization factor, defaults to 1.0.
- Returns:
RBP score
- Return type: