Bradley-Terry

evalica.bradley_terry(xs, ys, winners, index=None, weights=None, win_weight=1.0, tie_weight=0.5, solver='pyo3', tolerance=1e-06, limit=100, **kwargs)[source]

Compute the Bradley-Terry scores for the given pairwise comparison.

Note

Bradley, R.A., Terry, M.E.: Rank Analysis of Incomplete Block Designs: I. The Method of Paired Comparisons. Biometrika. 39, 324–345 (1952). <https://doi.org/10.2307/2334029>.

Note

Newman, M.E.J.: Efficient Computation of Rankings from Pairwise Comparisons. Journal of Machine Learning Research. 24, 1–25 (2023). <https://www.jmlr.org/papers/v24/22-1086.html>.

Parameters:
  • xs (Collection[T_contra]) – The left-hand side elements.

  • ys (Collection[T_contra]) – The right-hand side elements.

  • winners (Collection[Winner]) – The winner elements.

  • index (Index | None) – The index.

  • weights (Collection[float] | None) – The example weights.

  • win_weight (float) – The win weight.

  • tie_weight (float) – The tie weight.

  • solver (Literal['naive', 'pyo3']) – The solver.

  • tolerance (float) – The convergence tolerance.

  • limit (int) – The maximum number of iterations.

  • **kwargs (Any) – The additional arguments.

Returns:

The Bradley-Terry result.

Return type:

BradleyTerryResult

class evalica.BradleyTerryResult(scores, index, win_weight, tie_weight, solver, tolerance, iterations, limit)[source]

The Bradley-Terry result.

Parameters:
scores

The element scores.

Type:

pandas.Series

index

The index.

Type:

pandas.Index

win_weight

The win weight.

Type:

float

tie_weight

The tie weight.

Type:

float

solver

The solver.

Type:

Literal[‘naive’, ‘pyo3’]

tolerance

The convergence tolerance.

Type:

float

iterations

The actual number of iterations.

Type:

int

limit

The maximum number of iterations.

Type:

int

evalica.newman(xs, ys, winners, index=None, v_init=0.5, weights=None, win_weight=1.0, tie_weight=1.0, solver='pyo3', tolerance=1e-06, limit=100, **kwargs)[source]

Compute the scores for the given pairwise comparison using the Newman’s algorithm.

Note

Newman, M.E.J.: Efficient Computation of Rankings from Pairwise Comparisons. Journal of Machine Learning Research. 24, 1–25 (2023). <https://www.jmlr.org/papers/v24/22-1086.html>.

Parameters:
  • xs (Collection[T_contra]) – The left-hand side elements.

  • ys (Collection[T_contra]) – The right-hand side elements.

  • winners (Collection[Winner]) – The winner elements.

  • index (Index | None) – The index.

  • v_init (float) – The initial tie parameter.

  • weights (Collection[float] | None) – The example weights.

  • win_weight (float) – The win weight.

  • tie_weight (float) – The tie weight.

  • solver (Literal['naive', 'pyo3']) – The solver.

  • tolerance (float) – The convergence tolerance.

  • limit (int) – The maximum number of iterations.

  • **kwargs (Any) – The additional arguments.

Returns:

The Newman’s result.

Return type:

NewmanResult

class evalica.NewmanResult(scores, index, v, v_init, win_weight, tie_weight, solver, tolerance, iterations, limit)[source]

The Newman’s algorithm result.

Parameters:
scores

The element scores.

Type:

pandas.Series

index

The index.

Type:

pandas.Index

v

The tie parameter.

Type:

float

v_init

The initial tie parameter.

Type:

float

win_weight

The win weight.

Type:

float

tie_weight

The tie weight.

Type:

float

solver

The solver.

Type:

Literal[‘naive’, ‘pyo3’]

tolerance

The convergence tolerance.

Type:

float

iterations

The actual number of iterations.

Type:

int

limit

The maximum number of iterations.

Type:

int