votesim.votesystems.score

Function Summary

approval100(data[, numwin, threshold])

Approval voting with 100% cutoff threshold; rounds scores.

approval25(data[, numwin])

Approval voting with 25% cutoff threshold; rounds scores.

approval50(data[, numwin])

Approval voting with 50% cutoff threshold; rounds scores.

approval75(data[, numwin])

majority_judgment(data[, numwin, …])

Majority judgment (median score).

reweighted_range(data[, numwin, C_ratio, …])

Multi-winner election using reweighted range voting.

score(data[, numwin])

Score voting.

score10(data[, numwin])

Score voting specifying 11 total score bins from 0 to 10.

score5(data[, numwin])

Score voting specifying 6 total score bins from 0 to 5.

sequential_monroe(data[, numwin, maxscore])

Multi-winner score based on Parker_Friedland’s Reddit post https://www.reddit.com/r/EndFPTP/comments/auyxny/can_anyone_give_a_summary_of_multiwinner_methods/ehgkfbl/

star(data[, numwin])

STAR voting (Score then Automatic Runoff)

star10(data[, numwin])

STAR voting with 11 total score bins from 0 to 10.

star5(data[, numwin])

STAR voting with 6 total score bins from 0 to 5.

Module Functions

approval100

votesim.votesystems.score.approval100(data, numwin=1, threshold=0.01)

Approval voting with 100% cutoff threshold; rounds scores.

See score

approval25

votesim.votesystems.score.approval25(data, numwin=1)

Approval voting with 25% cutoff threshold; rounds scores.

See score

approval50

votesim.votesystems.score.approval50(data, numwin=1)

Approval voting with 50% cutoff threshold; rounds scores.

See score

approval75

votesim.votesystems.score.approval75(data, numwin=1)

majority_judgment

votesim.votesystems.score.majority_judgment(data, numwin=1, remove_nulls=True, maxiter=100000.0)

Majority judgment (median score).

Parameters
  • data (array shaped (a, b)) –

    Election voter scores, 0 to max. Data of candidate ratings for each voter, with

    • a Voters represented as each rows

    • b Candidates represented as each column.

  • numwin (int) – Number of winners to consider

  • remove_nulls (bool) – If True (default), remove any ballots that are marked with all zeros.

Returns

  • winners (array of shape (numwin,)) – Winning candidates index.

  • ties (array of shape (tienum,)) – Tied candidates index for the last round, numbering ‘tienum’.

  • sums (array of shape (numwin, b)) – Median scores for each candidate.

reweighted_range

votesim.votesystems.score.reweighted_range(data, numwin=1, C_ratio=1.0, maxscore=None)

Multi-winner election using reweighted range voting.

https://www.rangevoting.org/RRVr.html

Parameters
  • data (array shaped (a, b)) –

    Election voter scores, 0 to max. Data of candidate ratings for each voter, with

    • a Voters represented as each rows

    • b Candidates represented as each column.

  • numwin (int) – Number of winners to consider

  • C_ratio (float) –

    Proportionality factor

    • C_ratio = 1.0 – M; Greatest divisors (d’Hondt, Jefferson) proportionality

    • C_ratio = 0.5 – M/2; Major fractions (Webster, Saint-Lague) method

  • maxscore (None (default), float) – Maximum score to use for calculation of C. Use max of data if None.

Returns

  • winners (array of shape (numwin,)) – Winning candidates index.

  • ties (array of shape (tienum,)) – Tied candidates index for the last round, numbering ‘tienum’.

  • round_history (array of shape (numwin, b)) – Score summations for each candidate, for each round.

    • rows numwin – Represents each round for total number of winners

    • columns b – Represents each candidate.

    • data is net score of each candidate for each round.

score

votesim.votesystems.score.score(data, numwin=1)

Score voting.

Parameters
  • data (array shaped (a, b)) –

    Election voter scores, 0 to max. Data of candidate ratings for each voter, with

    • a Voters represented as each rows

    • b Candidates represented as each column.

  • numwin (int) – Number of winners to consider

Returns

  • winners (array of shape (numwin,)) – Winning candidates index.

  • ties (array of shape (tienum,)) – Tied candidates index for the last round, numbering ‘tienum’.

  • sums (array of shape (numwin, b)) – Score summations for each candidate.

score10

votesim.votesystems.score.score10(data, numwin=1)

Score voting specifying 11 total score bins from 0 to 10. See score.

score5

votesim.votesystems.score.score5(data, numwin=1)

Score voting specifying 6 total score bins from 0 to 5. See score.

sequential_monroe

votesim.votesystems.score.sequential_monroe(data, numwin=1, maxscore=None)

Multi-winner score based on Parker_Friedland’s Reddit post https://www.reddit.com/r/EndFPTP/comments/auyxny/can_anyone_give_a_summary_of_multiwinner_methods/ehgkfbl/

  1. For candidate X, sort the ballots in order of highest score given to candidate X to lowest score given to candidate X.

  2. Calculate the average score given to X on the first hare quota of those ballots. Record this score as that candidate’s hare quota score. See Footnote.

  3. Repeat this process for every candidate.

  4. Elect the candidate with the highest hare quota score and exhaust the votes that contribute to that candidate’s hare quota score.

  5. Repeat this process until all the seats are filled.

Parameters
  • data (array shaped (a, b)) –

    Election voter scores, 0 to max. Data of candidate ratings for each voter, with

    • a Voters represented as each row.

    • b Candidates represented as each column.

  • numwin (int) – Number of winners to consider

Returns

  • winners (array of shape (numwin,)) – Winning candidates index.

  • ties (array of shape (tienum,)) – Tied candidates index for the last round, numbering ‘tienum’.

  • round_history (array of shape (numwin, b)) – Average scores of top quota for each candidate, for each round.

    • rows numwin – Represents each round for total number of winners

    • columns b – Represents each candidate.

    • data is net score of each candidate for each round.

star

votesim.votesystems.score.star(data, numwin=1)

STAR voting (Score then Automatic Runoff)

Parameters
  • data (array shaped (a, b)) –

    Election voter scores, 0 to max. Data of candidate ratings for each voter, with

    • a Voters represented as each rows

    • b Candidates represented as each column.

  • numwwin (int) – Multi-winners… parameter > 1 not supported!!

Returns

  • winners (array of shape (numwin,)) – Winning candidates index.

  • ties (array of shape (tienum,)) – Tied candidates index for the last round, numbering ‘tienum’.

  • output (dict) –

    sumsarray shape (b,)

    Score sums for all candidates

    runoff_candidatesarray shape (c,)

    Candidates that made the runoff

    runoff_matrixarray shape (c, c)

    Votes for and against each candidate in runoff

    runoff_sumsarray shape (c,)

    Votes for each candidate in runoff

star10

votesim.votesystems.score.star10(data, numwin=1)

STAR voting with 11 total score bins from 0 to 10. See star.

star5

votesim.votesystems.score.star5(data, numwin=1)

STAR voting with 6 total score bins from 0 to 5. See star.