lenskit.metrics.ListMetric#

class lenskit.metrics.ListMetric#

Bases: Metric

Base class for metrics that measure individual recommendation (or prediction) lists, and whose results may be aggregated to compute overall metrics.

For prediction metrics, this is macro-averaging.

__init__()#

Methods

__init__()

measure_list(output, test, /)

Compute the metric value for a single result list.

Attributes

default

The default value to infer when computing statistics over missing values.

label

The metric's default label in output.

default: ClassVar[float | None] = 0.0#

The default value to infer when computing statistics over missing values. If None, no inference is done (necessary for metrics like RMSE, where the missing value is theoretically infinite).

abstract measure_list(output, test, /)#

Compute the metric value for a single result list.

Individual metric classes need to implement this method.

Parameters:
Return type:

float