lenskit.metrics.ranking.GeometricRankWeight#

class lenskit.metrics.ranking.GeometricRankWeight(patience=0.85)#

Bases: RankWeight

Geometric cascade weighting for result ranks.

This is the ranking model used by RBP [MZ08].

For patience \(p\), the discount is given by \(p^{k-1}\). The sum of this infinite series is \(\frac{1}{1 - p}\).

Parameters:

patience (Annotated[float, Gt(0.0), Lt(1.0)]) – The patience parameter \(p\).

Stability:
Caller (see Stability Levels).
patience: float#
weight(ranks)#

Compute the discount for the specified ranks.

Ranks must start with 1.

Return type:

lenskit.data.types.NPVector[numpy.float64]

log_weight(ranks)#

Compute the (natural) log of the discount for the specified ranks.

Ranks must start with 1.

Return type:

lenskit.data.types.NPVector[numpy.float64]

series_sum()#

Get the sum of the infinite series of this discount function, if known. Some metrics (e.g. RBP()) will use this to normalize their measurements.

Return type:

float