Trivial Rules

Sum of scores (Range Voting)

class embedded_voting.RuleSumRatings(score_components=1, embeddings_from_ratings=None)[source]

Voting rule in which the score of a candidate is the sum of her ratings.

No embeddings are used for this rule.

Parameters:
  • score_components (int) – The number of components in the aggregated score of every candidate. If > 1, we perform a lexical sort to obtain the ranking.
  • embeddings_from_ratings (EmbeddingsFromRatings) – If no embeddings are specified in the call, this EmbeddingsFromRatings object is use to generate the embeddings from the ratings. Default: EmbeddingsFromRatingsIdentity().

Examples

>>> ratings = Ratings(np.array([[.5, .6, .3], [.7, 0, .2], [.2, 1, .8]]))
>>> election = RuleSumRatings()(ratings)
>>> election.scores_
[1.4, 1.6, 1.3]
>>> election.ranking_
[1, 0, 2]
>>> election.winner_
1
>>> election.welfare_
[0.3333333333333328, 1.0, 0.0]

Product of scores (Nash)

class embedded_voting.RuleShiftProduct(score_components=1, embeddings_from_ratings=None)[source]

Voting rule in which the score of a candidate is the product of her ratings, shifted by 2, and clamped at 0.1.

No embeddings are used for this rule.

Parameters:
  • score_components (int) – The number of components in the aggregated score of every candidate. If > 1, we perform a lexical sort to obtain the ranking.
  • embeddings_from_ratings (EmbeddingsFromRatings) – If no embeddings are specified in the call, this EmbeddingsFromRatings object is use to generate the embeddings from the ratings. Default: EmbeddingsFromRatingsIdentity().

Examples

>>> ratings = Ratings(np.array([[.5, .6, .3], [.7, 0, .2], [.2, 1, .8]]))
>>> election = RuleShiftProduct()(ratings)
>>> election.scores_
[14.85..., 15.60..., 14.16...]
>>> election.ranking_
[1, 0, 2]
>>> election.winner_
1