lenskit.metrics.ranking.ExposureGini#
- class lenskit.metrics.ranking.ExposureGini(n=None, *, k=None, items, weight=GeometricRankWeight())#
Bases:
GiniBaseMeasure exposure distribution of recommendations with the Gini coefficient.
This uses a weighting model to compute the exposure of each item in each list, and computes the Gini coefficient of the total exposure.
- Parameters:
n (int | None) – The maximum recommendation list length.
items (lenskit.data.Vocabulary | lenskit.data.Dataset) – The item vocabulary or a dataset from which to extract the items.
weight (lenskit.metrics.ranking._weighting.RankWeight) – The rank weighting model to use. Defaults to
GeometricRankWeightwith the specified patience parameter.k (int | None)
- Stability:
- Caller (see Stability Levels).
- measure_list(output, 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:
output (lenskit.data.ItemList)
- Return type:
tuple[numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.float64]]