lenskit.metrics.RankingMetricBase#
- class lenskit.metrics.RankingMetricBase(k=None)#
Bases:
MetricBase class for most ranking metrics, implementing a
kparameter for truncation.- Parameters:
k (int | None) – Specify the length cutoff for rankings. Rankings longer than this will be truncated prior to measurement.
- Stability:
- Caller (see Stability Levels).
Methods
__init__([k])extract_list_metrics(data, /)Extract per-list metric(s) from intermediate measurement data.
measure_list(output, test, /)Compute measurements for a single list.
summarize(values, /)Aggregate intermediate values into summary statistics.
truncate(items)Truncate an item list if it is longer than
k.Attributes
- property label#
Default name — class name, optionally @K.