- class svvamp.RuleMajorityJudgment(**kwargs)[source]#
Majority Judgment.
- Parameters:
min_grade (number) – Minimal grade allowed.
max_grade (number) – Maximal grade allowed.
step_grade (number) –
Interval between two consecutive allowed grades.
If
step_grade = 0
, all grades in the interval [min_grade
,max_grade
] are allowed (‘continuous’ set of grades).If
step_grade > 0
, authorized grades are the multiples ofstep_grade
lying in the interval [min_grade
,max_grade
]. In addition, the gradesmin_grade
andmax_grade
are always authorized, even if they are not multiples ofstep_grade
.
rescale_grades (bool) –
Whether sincere voters rescale their utilities to produce grades.
If
rescale_grades
=True
, then each sincere voterv
applies an affine transformation to send her utilities into the interval [min_grade
,max_grade
].If
rescale_grades
=False
, then each sincere voterv
clips her utilities into the interval [min_grade
,max_grade
].
See
ballots
for more details.Options
------- –
>>> RuleMajorityJudgment.print_options_parameters() cm_option: ['exact']. Default: 'exact'. icm_option: ['exact']. Default: 'exact'. iia_subset_maximum_size: is_number. Default: 2. im_option: ['exact']. Default: 'exact'. max_grade: isfinite. Default: 1. min_grade: isfinite. Default: 0. precheck_heuristic: [False]. Default: False. rescale_grades: is_bool. Default: True. step_grade: isfinite. Default: 0. tm_option: ['exact']. Default: 'exact'. um_option: ['exact']. Default: 'exact'.
Notes
Each voter attributes a grade to each candidate. By default, authorized grades are all numbers in the interval [
min_grade
,max_grade
]. To use a discrete set of notes, modify attributestep_grade
.Note
Majority Judgement, as promoted by its authors, uses a discrete set of non-numerical grades. For our purposes, using a discrete set of numerical grades (
step_grade
> 0) is isomorphic to this voting system. In contrast, using a continuous set of grades (step_grade
= 0) is a variant of this voting system, which has the advantage of being canonical, in the sense that there is no need to choose the number of authorized grades more or less arbitrarily.The candidate with highest median grade wins. For the tie-breaking rule, see
scores
.Default behavior of sincere voters: voter
v
applies an affine transformation to her utilitiespreferences_ut
[v, :]
to get her grades, such that her least-liked candidate receivesmin_grade
and her most-liked candidate receivesmax_grade
. To modify this behavior, use attributerescale_grades
. For more details about the behavior of sincere voters, seeballots
.not_iia()
:If
rescale_grades
=False
, then Majority Judgment always meets IIA.If
rescale_grades
=True
, then non-polynomial or non-exact algorithms from superclassRule
are used.
is_cm_()
,is_icm_()
,is_im_()
,is_tm_()
,is_um_()
: Exact in polynomial time.
References
Majority Judgment : Measuring, Ranking, and Electing. Michel Balinski and Rida Laraki, 2010.
Examples
>>> profile = Profile(preferences_ut=[ ... [ 0. , -0.5, -1. ], ... [ 1. , -1. , 0.5], ... [ 0.5, 0.5, -0.5], ... [ 0.5, 0. , 1. ], ... [-1. , -1. , 1. ], ... ], preferences_rk=[ ... [0, 1, 2], ... [0, 2, 1], ... [1, 0, 2], ... [2, 0, 1], ... [2, 1, 0], ... ]) >>> rule = RuleMajorityJudgment()(profile) >>> rule.demo_results_(log_depth=0) ************************ * * * Election Results * * * ************************ *************** * Results * *************** profile_.preferences_ut (reminder) = [[ 0. -0.5 -1. ] [ 1. -1. 0.5] [ 0.5 0.5 -0.5] [ 0.5 0. 1. ] [-1. -1. 1. ]] profile_.preferences_rk (reminder) = [[0 1 2] [0 2 1] [1 0 2] [2 0 1] [2 1 0]] ballots = [[1. 0.5 0. ] [1. 0. 0.75] [1. 1. 0. ] [0.5 0. 1. ] [0. 0. 1. ]] scores = [[ 1. 0. 0.75] [-2. 2. -2. ]] candidates_by_scores_best_to_worst [0 2 1] scores_best_to_worst [[ 1. 0.75 0. ] [-2. -2. 2. ]] w = 0 score_w = [ 1. -2.] total_utility_w = 1.0 ********************************* * Condorcet efficiency (rk) * ********************************* w (reminder) = 0 condorcet_winner_rk_ctb = 0 w_is_condorcet_winner_rk_ctb = True w_is_not_condorcet_winner_rk_ctb = False w_missed_condorcet_winner_rk_ctb = False condorcet_winner_rk = 0 w_is_condorcet_winner_rk = True w_is_not_condorcet_winner_rk = False w_missed_condorcet_winner_rk = False *************************************** * Condorcet efficiency (relative) * *************************************** w (reminder) = 0 condorcet_winner_ut_rel_ctb = 0 w_is_condorcet_winner_ut_rel_ctb = True w_is_not_condorcet_winner_ut_rel_ctb = False w_missed_condorcet_winner_ut_rel_ctb = False condorcet_winner_ut_rel = 0 w_is_condorcet_winner_ut_rel = True w_is_not_condorcet_winner_ut_rel = False w_missed_condorcet_winner_ut_rel = False *************************************** * Condorcet efficiency (absolute) * *************************************** w (reminder) = 0 condorcet_admissible_candidates = [ True False False] w_is_condorcet_admissible = True w_is_not_condorcet_admissible = False w_missed_condorcet_admissible = False weak_condorcet_winners = [ True False False] w_is_weak_condorcet_winner = True w_is_not_weak_condorcet_winner = False w_missed_weak_condorcet_winner = False condorcet_winner_ut_abs_ctb = 0 w_is_condorcet_winner_ut_abs_ctb = True w_is_not_condorcet_winner_ut_abs_ctb = False w_missed_condorcet_winner_ut_abs_ctb = False condorcet_winner_ut_abs = 0 w_is_condorcet_winner_ut_abs = True w_is_not_condorcet_winner_ut_abs = False w_missed_condorcet_winner_ut_abs = False resistant_condorcet_winner = nan w_is_resistant_condorcet_winner = False w_is_not_resistant_condorcet_winner = True w_missed_resistant_condorcet_winner = False >>> rule.demo_manipulation_(log_depth=0) ***************************** * * * Election Manipulation * * * ***************************** ********************************************* * Basic properties of the voting system * ********************************************* with_two_candidates_reduces_to_plurality = False is_based_on_rk = False is_based_on_ut_minus1_1 = True meets_iia = False **************************************************** * Manipulation properties of the voting system * **************************************************** Condorcet_c_ut_rel_ctb (False) ==> Condorcet_c_ut_rel (False) || || || Condorcet_c_rk_ctb (False) ==> Condorcet_c_rk (False) || || || || || || || V V || || V V Condorcet_c_ut_abs_ctb (False) ==> Condorcet_ut_abs_c (False) || || || || || V V || || maj_fav_c_rk_ctb (False) ==> maj_fav_c_rk (False) || || || || || V V V V majority_favorite_c_ut_ctb (False) ==> majority_favorite_c_ut (False) || || V V IgnMC_c_ctb (True) ==> IgnMC_c (True) || || V V InfMC_c_ctb (True) ==> InfMC_c (True) ***************************************************** * Independence of Irrelevant Alternatives (IIA) * ***************************************************** w (reminder) = 0 is_iia = True log_iia: iia_subset_maximum_size = 2.0 example_winner_iia = nan example_subset_iia = nan ********************** * c-Manipulators * ********************** w (reminder) = 0 preferences_ut (reminder) = [[ 0. -0.5 -1. ] [ 1. -1. 0.5] [ 0.5 0.5 -0.5] [ 0.5 0. 1. ] [-1. -1. 1. ]] v_wants_to_help_c = [[False False False] [False False False] [False False False] [False False True] [False False True]] ************************************ * Individual Manipulation (IM) * ************************************ is_im = False log_im: im_option = exact candidates_im = [0. 0. 0.] ********************************* * Trivial Manipulation (TM) * ********************************* is_tm = False log_tm: tm_option = exact candidates_tm = [0. 0. 0.] ******************************** * Unison Manipulation (UM) * ******************************** is_um = False log_um: um_option = exact candidates_um = [0. 0. 0.] ********************************************* * Ignorant-Coalition Manipulation (ICM) * ********************************************* is_icm = False log_icm: icm_option = exact candidates_icm = [0. 0. 0.] necessary_coalition_size_icm = [0. 6. 4.] sufficient_coalition_size_icm = [0. 6. 4.] *********************************** * Coalition Manipulation (CM) * *********************************** is_cm = False log_cm: cm_option = exact candidates_cm = [0. 0. 0.] necessary_coalition_size_cm = [0. 3. 3.] sufficient_coalition_size_cm = [0. 3. 3.]
- property ballots_#
2d array of integers.
ballots[v, c]
is the grade attributed by voterv
to candidatec
(when voting sincerely). The following process is used.Convert utilities into grades in the interval [
min_grade
,max_grade
].If
rescale_grades
=True
, then each voterv
applies an affine transformation topreferences_ut
[v, :]
such that her least-liked candidate receivesmin_grade
and her most-liked candidate receivesmax_grade
. Exception: if she is indifferent between all candidates, then she attributes (min_grade
+max_grade
) / 2 to all of them.If
rescale_grades
=False
, then each voterv
clips her utilities into the interval [min_grade
,max_grade
]: each utility greater thanmax_grade
(resp. lower thanmin_grade
) becomesmax_grade
(resp.min_grade
).
If
step_grades
> 0 (discrete set of grades), round each grade to the closest authorized grade.
Examples
>>> profile = Profile(preferences_ut=[ ... [ 1. , 0.8, -0.6], ... [ 0.2, -0.4, 1. ], ... [ 1. , 0. , 0.2], ... [ 0.2, 0.8, -0.2], ... ]) >>> rule = RuleMajorityJudgment(min_grade=0, max_grade=5, step_grade=1)(profile) >>> rule.ballots_ array([[5, 4, 0], [2, 0, 5], [5, 0, 1], [2, 5, 0]])
- property scores_#
2d array of integers.
scores[0, c]
is the median grade of candidatec
.Let us note
p
(resp.q
) the number of voter who attribute toc
a grade higher (resp. lower) than the median. Ifp
>q
, thenscores[1, c]
=p
. Otherwise,scores[1, c]
=-q
.
- property w_#
Integer (winning candidate).
Candidates are sorted lexicographically by their median (
scores
[0, c]
) then theirp
or-q
(scores
[1, c]
). If there is still a tie, the tied candidate with lower index is declared the winner.