Convert utilities to optimal approval voting ballots.
Given a set of utilities for each voter-candidate pair, each voter is
modeled as maximizing their expected utility, by approving any candidate
that exceeds their mean utility over all candidates. [1]_
Parameters:
utilities (array_like) –
A 2D collection of utilities.
Rows represent voters, and columns represent candidate IDs.
Higher utility numbers mean greater approval of that candidate by that
voter.
Returns:
election – A 2D collection of approval ballots.
Rows represent voters, and columns represent candidate IDs.
A cell contains 1 if that voter approves of that candidate,
otherwise 0.
Return type:
ndarray
References
Examples
Voter 0 loves Candidates A (index 0) and B (index 1), but hates C (2).
Voter 1 dislikes A, likes B, and loves C.
Voter 2 hates A, and is lukewarm about B and C.
Each voter optimally chooses their approval threshold based on their mean
utility:
Voter 0 approves A and B.
Voter 1 approves B and C.
Voter 2 approves B and C.
Convert utilities into scores using honest (but normalized) strategy.
Given a set of utilities for each voter-candidate pair, each voter is
modeled as giving their favorite candidate a maximum score, least favorite
candidate a minimum score, and proportional scores in between.
Parameters:
utilities (array_like) –
A 2D collection of utilities.
Rows represent voters, and columns represent candidate IDs.
Higher utility numbers mean greater approval of that candidate by that
voter.
max_score (int, optional) – The highest score on the ballot. If max_score = 3, the possible
scores are 0, 1, 2, 3.
Returns:
election – A 2D collection of score ballots.
Rows represent voters, and columns represent candidate IDs.
A cell contains a high score if that voter approves of that candidate,
or low score if they disapprove
Return type:
ndarray
Examples
Voter 0 loves Candidates A (index 0) and B (index 1), but hates C (2).
Voter 1 dislikes A, likes B, and loves C.
Voter 2 hates A, and is lukewarm about B and C.
Convert utilities into rankings using honest strategy.
Parameters:
utilities (array_like) –
A 2D collection of utilities.
Rows represent voters, and columns represent candidate IDs.
Higher utility numbers mean greater approval of that candidate by that
voter.
Returns:
election – A collection of ranked ballots.
Rows represent voters and columns represent rankings, from best to
worst, with no tied rankings.
Each cell contains the ID number of a candidate, starting at 0.
For example, if a voter ranks Curie > Avogadro > Bohr, the ballot line
would read [2,0,1] (with IDs in alphabetical order).
Return type:
array_like
Examples
Generate an election with 4 voters and 3 candidates:
Convert utilities to approval voting ballots, approving top k candidates.
Given a set of utilities for each voter-candidate pair, each voter is
modeled as voting for the top k candidates. [1]_
Parameters:
utilities (array_like) –
A 2D collection of utilities.
Rows represent voters, and columns represent candidate IDs.
Higher utility numbers mean greater approval of that candidate by that
voter.
k (int or 'half') – The number of candidates approved of by each voter, or ‘half’ to make
the number dependent on the number of candidates. If a negative int,
then vote for n-k candidates, where n is the total number.
Returns:
election – A 2D collection of approval ballots.
Rows represent voters, and columns represent candidate IDs.
A cell contains 1 if that voter approves of that candidate,
otherwise 0.
Return type:
ndarray
References
Examples
Voter 0 loves Candidates A (index 0) and B (index 1), but hates C (2).
Voter 1 dislikes A, likes B, and loves C.
Voter 2 hates A, and is lukewarm about B and C.