lenskit.metrics.ranking.RankBiasedEntropy#
- class lenskit.metrics.ranking.RankBiasedEntropy(dataset, attribute, n=None, *, weight=None)#
Bases:
lenskit.metrics.ranking._base.ListMetric,lenskit.metrics.ranking._base.RankingMetricBaseEvaluate diversity using rank-biased Shannon entropy over item categories.
This metric measures the diversity of categories in recommendation list with rank-based weighting, giving more importance to items at the top of the recommendation list.
- Parameters:
dataset (lenskit.data.Dataset) – The LensKit dataset containing item entities and their attributes.
attribute (str) – Name of the attribute to use for categories (e.g., ‘genre’, ‘tag’)
n (int | None) – Recommendation list length to evaluate
weight (lenskit.metrics.ranking._weighting.RankWeight | None) – Rank weighting model. Defaults to GeometricRankWeight(0.85)
- Stability:
- Caller (see Stability Levels).
- property label#
The metric’s default label in output. The base implementation returns the class name by default.
- measure_list(recs, test)#
Compute measurements for a single list.
- Returns:
A float for simple metrics
Intermediate data for decomposed metrics
A dict mapping metric names to values for multi-metric classes
- Parameters:
recs (lenskit.data.ItemList)
test (lenskit.data.ItemList)
- Return type: