Plackett-Luce Models#
Plackett-Luce models are parameterised by a vector of quality for the candidates. The higher the quality of a candidate, the higher the change that they show up high in the rankings.
- plackett_luce(num_voters: int, num_candidates: int, alphas: list[float], seed: int = None) list[list[int]] [source]#
Generates ordinal votes according to Plackett-Luce model.
This model is parameterised by a vector alphas intuitively indicating a quality for each candidate. A vote is generated in m steps (m being the number of candidates). The vote is filled up from most preferred to least preferred candidate. For the initial draw, the probability of selecting a candidate is equal to its quality (normalised). Then, this candidate is removed and the quality are re-normalised.
A collection of num_voters vote is generated independently and identically following the process described above.
For a similar model, see the
didi()
model.- Parameters:
num_voters (int) – Number of Voters.
num_candidates (int) – Number of Candidates.
alphas (list[float]) – List of model parameters (quality of the candidates).
seed (int, default:
None
) – Seed for numpy random number generator.
- Returns:
Ordinal votes.
- Return type:
list[list[int]]
Examples
from prefsampling.ordinal import plackett_luce # Sample from a Plackett-Luce model with 2 voters and 3 candidates, the qualities of # candidates are 0.5, 0.2, and 0.1. plackett_luce(2, 3, (0.5, 0.2, 0.1)) # For reproducibility, you can set the seed. plackett_luce(2, 3, (5, 2, 0.7), seed=1002) # Don't forget to provide a quality for all candidates try: plackett_luce(2, 3, (0.5, 0.2)) except ValueError: pass # And all quality scores need to be strictly positive try: plackett_luce(2, 3, (0.5, 0.2, -0.4)) except ValueError: pass try: plackett_luce(2, 3, (0.5, 0.2, 0)) except ValueError: pass
Validation
The probability distribution governing the Plackett-Luce model is well documented. Specifically, given n agents and m candidates and a vector of candidates qualities \mathbf{\alpha} = (\alpha_1, \ldots, \alpha_m), the probability of generating a ranking a_{i_1} \succ a_{i_2} \succ \cdots \succ a_{i_m} is equal to:
\frac{\alpha_{i_1}}{1} \times \frac{\alpha_{i_2}}{\sum_{p > 1}\alpha_{i_p}} \times \cdots \times \frac{\alpha_{i_{m-1}}}{\alpha_{i_{m-1}} + \alpha_{i_m}}.
We test that the observed frequencies of rankings aligns with the theoretical probability distribution.
When all values in
alphas
are equal, we are supposed to observe a uniform distribution over all rankings.References
Individual Choice Behavior: A Theoretical Analysis, R. Duncan Luce, New York: Wiley, 1959.
The Analysis of Permutations, Robert L. Plackett, Applied Statistics 24 (2): 193–202, 1975.
Learning Mixtures of Plackett-Luce Models, Zhibing Zhao, Peter Piech and Lirong Xia, Proceedings of the International Conference on Machine Learning (pp. 2906-2914), 2016.