lenskit.reranking.fair.FAIRReranker#
- class lenskit.reranking.fair.FAIRReranker(config=None, **kwargs)#
Bases:
lenskit.pipeline.Component[lenskit.data.ItemList],lenskit.training.TrainableFA*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
pand significance levelalpha.For details, see Zehlike et al. (2017).
- Stability:
- Caller (see Stability Levels).
- Parameters:
config (object | None)
kwargs (Any)
- config: FAIRRerankerConfig#
FA*IR reranker configuration.
- 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:
attributes (protected) – The item entity table must have a scalar attribute
protectedthat isTrueif the item is in the protected group andFalseotherwise.data (lenskit.data.Dataset)
options (lenskit.training.TrainingOptions)
- __call__(items, n=None)#
Run the pipeline’s operation and produce a result. This is the key method for components to implement.
- Parameters:
items (lenskit.data.ItemList)
n (int | None)
- Return type: