lenskit.metrics.GeometricRankWeight#

class lenskit.metrics.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 (float) – The patience parameter \(p\).

Stability:
Caller (see Stability Levels).
__init__(patience=0.85)#
Parameters:

patience (Annotated[float, Gt(gt=0.0), Lt(lt=1.0)])

Methods

__init__([patience])

log_weight(ranks)

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

series_sum()

Get the sum of the infinite series of this discount function, if known.

weight(ranks)

Compute the discount for the specified ranks.

Attributes

patience

weight(ranks)#

Compute the discount for the specified ranks.

Ranks must start with 1.

Return type:

ndarray[tuple[int], dtype[float64]]

log_weight(ranks)#

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

Ranks must start with 1.

Return type:

ndarray[tuple[int], dtype[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