lenskit.reranking.fair.FAIRReranker#

class lenskit.reranking.fair.FAIRReranker(config=None, **kwargs)#

Bases: lenskit.pipeline.Component[lenskit.data.ItemList], lenskit.training.Trainable

FA*IR top-N re-ranking algorithm.

Re-ranks a sorted candidate list to satisfy binomial lower-bound constraints for a binary protected/unprotected attribute at every prefix (1..N). It expects a sorted list of items, the target proportion of protected items p and significance level alpha.

For details, see Zehlike et al. (2017).

Stability:
Caller (see Stability Levels).
Parameters:
  • config (object | None)

  • kwargs (Any)

config: FAIRRerankerConfig#

FA*IR reranker configuration.

alpha_c: float#
m_list: list[int]#
is_trained()#

Query if this component has already been trained.

train(data, options=TrainingOptions())#

Precompute adjusted alpha and m-table for the configured (n,p,alpha)

Training computes the (multiple-tests–corrected) prefix requirements m[i] so that every prefix of size i has at least m[i] protected items with significance α (after correction).

Parameters:
__call__(items, n=None)#

Run the pipeline’s operation and produce a result. This is the key method for components to implement.

Parameters:
Return type:

lenskit.data.ItemList