Unanimous Models#
Identity samplers are not fascinating per se as all voters have the same preferences. There are useful tools however, for instance when using them in mixtures.
- identity(num_voters: int, num_candidates: int, seed: int = None) list[list[int]] [source]#
Generates unanimous ordinal votes, all votes being 0, 1, 2, ….
- Parameters:
num_voters (int) – Number of Voters.
num_candidates (int) – Number of Candidates.
seed (int, default:
None
) – Seed for numpy random number generator.
- Returns:
Ordinal votes.
- Return type:
list[list[int]]
Examples
from prefsampling.ordinal import identity # Sample a unanimous profile with 2 voters and 3 candidates identity(2, 3) # The seed will not change anything here, but you can still set it. identity(2, 3, seed=1002)
Validation
Validation is trivial here, we thus omit it.