# Tau Vector¶

class poisson_approval.TauVector(d_ballot_share: dict, voting_rule='Approval', symbolic=False, normalization_warning: bool = True)[source]

A vector ‘tau’ (ballot distribution)

Parameters: d_ballot_share (dict) – Ballot distribution, e.g. {'a': 0.1, 'ab': 0.6, 'c':0.3}. voting_rule (str) – The voting rule. Possible values are APPROVAL, PLURALITY and ANTI_PLURALITY. symbolic (bool) – Whether the computations are symbolic or numeric. normalization_warning (bool) – Whether a warning should be issued if the input distribution is not normalized.

Notes

If the input distribution d_ballot_share is not normalized, the tau vector will be normalized anyway and a warning is issued (unless normalization_warning is False).

Examples

>>> from fractions import Fraction
>>> tau = TauVector({'a': Fraction(1, 10), 'ab': Fraction(3, 5), 'c': Fraction(3, 10)})
>>> tau
TauVector({'a': Fraction(1, 10), 'ab': Fraction(3, 5), 'c': Fraction(3, 10)})
>>> print(tau)
<a: 1/10, ab: 3/5, c: 3/10> ==> a
>>> tau.a
Fraction(1, 10)
>>> tau.b
0
>>> tau.c
Fraction(3, 10)
>>> tau.ab
Fraction(3, 5)
>>> tau.ba  # Alternate notation for tau.ab
Fraction(3, 5)
>>> tau.ac
0
>>> tau.ca  # Alternate notation for tau.ac, etc.
0
>>> tau.bc
0
>>> tau.cb
0
>>> tau.duo_ab
<asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
>>> tau.duo_ba
<asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
>>> tau.duo_ac
<asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.87535 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
>>> tau.duo_ca
<asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.87535 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
>>> tau.duo_bc
<asymptotic = exp(- 0.0514719 n - 0.5 log n - 0.836813 + o(1)), phi_a = 1, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.duo_cb
<asymptotic = exp(- 0.0514719 n - 0.5 log n - 0.836813 + o(1)), phi_a = 1, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.pivot_weak_ab
<asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
>>> tau.pivot_weak_ba
<asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
>>> tau.pivot_weak_ac
<asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.87535 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
>>> tau.pivot_weak_ca
<asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.87535 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
>>> tau.pivot_weak_bc
<asymptotic = exp(- 0.151472 n - 0.5 log n - 0.836813 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.pivot_weak_cb
<asymptotic = exp(- 0.151472 n - 0.5 log n - 0.836813 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.pivot_strict_ab
<asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
>>> tau.pivot_strict_ba
<asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
>>> tau.pivot_strict_ac
<asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.87535 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
>>> tau.pivot_strict_ca
<asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.87535 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
>>> tau.pivot_strict_bc
<asymptotic = exp(- inf)>
>>> tau.pivot_strict_cb
<asymptotic = exp(- inf)>
>>> tau.pivot_tij_abc
<asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
>>> tau.pivot_tij_acb
<asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.371758 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
>>> tau.pivot_tij_bac
<asymptotic = exp(- 0.1 n + log n - 2.30259 + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
>>> tau.pivot_tij_bca
<asymptotic = exp(- 0.151472 n - 0.5 log n - 0.302013 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.pivot_tij_cab
<asymptotic = exp(- 0.0834849 n - 0.5 log n + 0.0518905 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
>>> tau.pivot_tij_cba
<asymptotic = exp(- 0.151472 n - 0.5 log n - 0.836813 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.pivot_tjk_abc
<asymptotic = exp(- inf)>
>>> tau.pivot_tjk_acb
<asymptotic = exp(- inf)>
>>> tau.pivot_tjk_bac
<asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.371758 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
>>> tau.pivot_tjk_bca
<asymptotic = exp(- 0.0834849 n - 0.5 log n + 0.0518905 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
>>> tau.pivot_tjk_cab
<asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
>>> tau.pivot_tjk_cba
<asymptotic = exp(- 0.1 n + log n - 2.30259 + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
>>> tau.trio
<asymptotic = exp(- 0.151472 n - 0.5 log n - 0.836813 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.trio_1t_a
<asymptotic = exp(- inf)>
>>> tau.trio_1t_b
<asymptotic = exp(- 0.151472 n + 0.5 log n - 3.48597 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.trio_1t_c
<asymptotic = exp(- 0.151472 n - 0.5 log n - 0.490239 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.trio_2t_ab
<asymptotic = exp(- 0.151472 n - 0.5 log n - 1.18339 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.trio_2t_ac
<asymptotic = exp(- inf)>
>>> tau.trio_2t_bc
<asymptotic = exp(- 0.151472 n + 0.5 log n - 3.1394 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.trio_2t_ba
<asymptotic = exp(- 0.151472 n - 0.5 log n - 1.18339 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
>>> tau.trio_2t_ca
<asymptotic = exp(- inf)>
>>> tau.trio_2t_cb
<asymptotic = exp(- 0.151472 n + 0.5 log n - 3.1394 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>

a

Share of the ballot 'a'.

Type: Number
ab

Share of the ballot 'ab'.

Type: Number
ac

Share of the ballot 'ac'.

Type: Number
b

Share of the ballot 'b'.

Type: Number
ba

Share of the ballot 'ab' (alternate notation).

Type: Number
bc

Share of the ballot 'bc'.

Type: Number
c

Share of the ballot 'c'.

Type: Number
ca

Share of the ballot 'ac' (alternate notation).

Type: Number
cb

Share of the ballot 'bc' (alternate notation).

Type: Number
d_ranking_best_response

Best response profile.

• Key: a ranking (e.g. 'abc').
• Value: a BestResponse (whose subclass depends on voting_rule).

Examples

>>> from fractions import Fraction
>>> tau = TauVector({'a': Fraction(1, 10), 'ab': Fraction(3, 5), 'c': Fraction(3, 10)})
>>> tau.d_ranking_best_response['abc']
<ballot = a, threshold_utility = 1, justification = Asymptotic method>

Type: dict
duo_ab

These two candidates have the same score.

Type: EventDuo
duo_ac

These two candidates have the same score.

Type: EventDuo
duo_ba

These two candidates have the same score.

Type: EventDuo
duo_bc

These two candidates have the same score.

Type: EventDuo
duo_ca

These two candidates have the same score.

Type: EventDuo
duo_cb

These two candidates have the same score.

Type: EventDuo
focus

Focus of this tau-vector.

This is based on the weak pivots.

Examples

>>> from fractions import Fraction
>>> tau = TauVector({'a': Fraction(1, 10), 'ab': Fraction(3, 5), 'c': Fraction(3, 10)})
>>> tau.focus
Focus.DIRECT

Type: Focus
has_two_consecutive_zeros

bool

Whether the tau-vector has two consecutive holes in the “compass” representation. True iff self.a == 0 and self.ab == 0, or self.ab == 0 and self.b == 0, etc.

is_standardized

Whether the profile is standardized or not. Cf. standardized_version().

Examples

>>> from fractions import Fraction
>>> tau = TauVector({'a': Fraction(1, 10), 'ab': Fraction(3, 5), 'c': Fraction(3, 10)})
>>> tau.is_standardized
False

isclose(other, *args, **kwargs)[source]

Test near-equality.

Parameters: other (Object) – *args – Cf. math.isclose(). **kwargs – Cf. math.isclose(). isclose – True if this tau-vector is approximately equal to other. Cf. isclose(). bool

Examples

>>> tau = TauVector({'ab': 0.4, 'b': 0.6})
>>> tau.isclose(TauVector({'ab': 0.4, 'b': 0.59999999999999999999999999}))
True

pivot_ab_easy_or_tight

True if the pivot ab is easy or tight, False if it is difficult.

Type: bool
pivot_ac_easy_or_tight

True if the pivot ac is easy or tight, False if it is difficult.

Type: bool
pivot_ba_easy_or_tight

Alternate notation for pivot_ab_easy_or_tight

Type: bool
pivot_bc_easy_or_tight

True if the pivot bc is easy or tight, False if it is difficult.

Type: bool
pivot_ca_easy_or_tight

Alternate notation for pivot_ac_easy_or_tight

Type: bool
pivot_cb_easy_or_tight

Alternate notation for pivot_bc_easy_or_tight

Type: bool
pivot_strict_ab

These two candidates have the same score, strictly higher than the other.

Type: EventPivotStrict
pivot_strict_ac

These two candidates have the same score, strictly higher than the other.

Type: EventPivotStrict
pivot_strict_ba

These two candidates have the same score, strictly higher than the other.

Type: EventPivotStrict
pivot_strict_bc

These two candidates have the same score, strictly higher than the other.

Type: EventPivotStrict
pivot_strict_ca

These two candidates have the same score, strictly higher than the other.

Type: EventPivotStrict
pivot_strict_cb

These two candidates have the same score, strictly higher than the other.

Type: EventPivotStrict
pivot_tij_abc

Personalized pivot of type Tij (between the two most-liked candidates).

Type: EventPivotTij
pivot_tij_acb

Personalized pivot of type Tij (between the two most-liked candidates).

Type: EventPivotTij
pivot_tij_bac

Personalized pivot of type Tij (between the two most-liked candidates).

Type: EventPivotTij
pivot_tij_bca

Personalized pivot of type Tij (between the two most-liked candidates).

Type: EventPivotTij
pivot_tij_cab

Personalized pivot of type Tij (between the two most-liked candidates).

Type: EventPivotTij
pivot_tij_cba

Personalized pivot of type Tij (between the two most-liked candidates).

Type: EventPivotTij
pivot_tjk_abc

Personalized pivot of type Tjk (between the two least-liked candidates).

Type: EventPivotTjk
pivot_tjk_acb

Personalized pivot of type Tjk (between the two least-liked candidates).

Type: EventPivotTjk
pivot_tjk_bac

Personalized pivot of type Tjk (between the two least-liked candidates).

Type: EventPivotTjk
pivot_tjk_bca

Personalized pivot of type Tjk (between the two least-liked candidates).

Type: EventPivotTjk
pivot_tjk_cab

Personalized pivot of type Tjk (between the two least-liked candidates).

Type: EventPivotTjk
pivot_tjk_cba

Personalized pivot of type Tjk (between the two least-liked candidates).

Type: EventPivotTjk
pivot_weak_ab

These two candidates have the same score, at least as high as the other.

Type: EventPivotWeak
pivot_weak_ac

These two candidates have the same score, at least as high as the other.

Type: EventPivotWeak
pivot_weak_ba

These two candidates have the same score, at least as high as the other.

Type: EventPivotWeak
pivot_weak_bc

These two candidates have the same score, at least as high as the other.

Type: EventPivotWeak
pivot_weak_ca

These two candidates have the same score, at least as high as the other.

Type: EventPivotWeak
pivot_weak_cb

These two candidates have the same score, at least as high as the other.

Type: EventPivotWeak
print_all_pivots()[source]

Print all the pivots.

Examples

>>> from fractions import Fraction
>>> tau = TauVector({'a': Fraction(1, 10), 'ab': Fraction(3, 5), 'c': Fraction(3, 10)})
>>> tau.print_all_pivots()
pivot_weak_ab:  <asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
pivot_weak_ac:  <asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.87535 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
pivot_weak_bc:  <asymptotic = exp(- 0.151472 n - 0.5 log n - 0.836813 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
pivot_strict_ab:  <asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
pivot_strict_ac:  <asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.87535 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
pivot_strict_bc:  <asymptotic = exp(- inf)>
pivot_tij_abc:  <asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
pivot_tij_acb:  <asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.371758 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
pivot_tij_bac:  <asymptotic = exp(- 0.1 n + log n - 2.30259 + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
pivot_tij_bca:  <asymptotic = exp(- 0.151472 n - 0.5 log n - 0.302013 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
pivot_tij_cab:  <asymptotic = exp(- 0.0834849 n - 0.5 log n + 0.0518905 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
pivot_tij_cba:  <asymptotic = exp(- 0.151472 n - 0.5 log n - 0.836813 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
pivot_tjk_abc:  <asymptotic = exp(- inf)>
pivot_tjk_acb:  <asymptotic = exp(- inf)>
pivot_tjk_bac:  <asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.371758 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
pivot_tjk_bca:  <asymptotic = exp(- 0.0834849 n - 0.5 log n + 0.0518905 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
pivot_tjk_cab:  <asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
pivot_tjk_cba:  <asymptotic = exp(- 0.1 n + log n - 2.30259 + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
trio:  <asymptotic = exp(- 0.151472 n - 0.5 log n - 0.836813 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
trio_1t_a:  <asymptotic = exp(- inf)>
trio_1t_b:  <asymptotic = exp(- 0.151472 n + 0.5 log n - 3.48597 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
trio_1t_c:  <asymptotic = exp(- 0.151472 n - 0.5 log n - 0.490239 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
trio_2t_ab:  <asymptotic = exp(- 0.151472 n - 0.5 log n - 1.18339 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
trio_2t_ac:  <asymptotic = exp(- inf)>
trio_2t_bc:  <asymptotic = exp(- 0.151472 n + 0.5 log n - 3.1394 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
duo_ab:  <asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
duo_ac:  <asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.87535 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
duo_bc:  <asymptotic = exp(- 0.0514719 n - 0.5 log n - 0.836813 + o(1)), phi_a = 1, phi_c = 1.41421, phi_ab = 0.707107>

print_weak_pivots()[source]

Print the weak pivots (including the 3-way tie).

Examples

>>> from fractions import Fraction
>>> tau = TauVector({'a': Fraction(1, 10), 'ab': Fraction(3, 5), 'c': Fraction(3, 10)})
>>> tau.print_weak_pivots()
pivot_weak_ab:  <asymptotic = exp(- 0.1 n + o(1)), phi_a = 0, phi_c = 1, phi_ab = 1>
pivot_weak_ac:  <asymptotic = exp(- 0.0834849 n - 0.5 log n - 0.87535 + o(1)), phi_a = 0.654654, phi_c = 1.52753, phi_ab = 0.654654>
pivot_weak_bc:  <asymptotic = exp(- 0.151472 n - 0.5 log n - 0.836813 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>
trio:  <asymptotic = exp(- 0.151472 n - 0.5 log n - 0.836813 + o(1)), phi_a = 0, phi_c = 1.41421, phi_ab = 0.707107>

score_a_in_duo_bc

Score of a in duo bc.

Type: Number
score_a_in_duo_cb

Alternate notation for score_a_in_duo_bc.

Type: Number
score_ab_in_duo_ab

Common score of a and b in duo ab.

Type: Number
score_ac_in_duo_ac

Common score of a and c in duo ac.

Type: Number
score_b_in_duo_ac

Score of b in duo ac.

Type: Number
score_b_in_duo_ca

Alternate notation for score_b_in_duo_ac.

Type: Number
score_ba_in_duo_ba

Alternate notation for score_ab_in_duo_ab.

Type: Number
score_bc_in_duo_bc

Common score of b and c in duo bc.

Type: Number
score_c_in_duo_ab

Score of c in duo ab.

Type: Number
score_c_in_duo_ba

Alternate notation for score_c_in_duo_ab.

Type: Number
score_ca_in_duo_ca

Alternate notation for score_ac_in_duo_ac.

Type: Number
score_cb_in_duo_cb

Alternate notation for score_bc_in_duo_bc.

Type: Number
scores

The scores.

Examples

>>> from fractions import Fraction
>>> tau = TauVector({'a': Fraction(1, 10), 'ab': Fraction(3, 5), 'c': Fraction(3, 10)})
>>> tau.scores
{'a': Fraction(7, 10), 'b': Fraction(3, 5), 'c': Fraction(3, 10)}

Type: Scores
standardized_version

Standardized version of the profile (makes it unique, up to permutations).

Notes

It returns the same profile, up to a permutation of the candidates. how the permutation is chosen in practice does not really matter: the important point is that the standardized version is the same for all the profile that are identical up to a permutation of the candidates.

Examples

>>> from fractions import Fraction
>>> tau = TauVector({'a': Fraction(1, 10), 'ab': Fraction(3, 5), 'c': Fraction(3, 10)})
>>> tau.standardized_version
TauVector({'a': Fraction(3, 10), 'b': Fraction(1, 10), 'bc': Fraction(3, 5)})

trio

trio.

Type: Event
trio_1t_a

This candidate has one vote less than the two others.

Type: EventTrio1t
trio_1t_b

This candidate has one vote less than the two others.

Type: EventTrio1t
trio_1t_c

This candidate has one vote less than the two others.

Type: EventTrio1t
trio_2t_ab

These candidates have one vote less than the other.

Type: EventTrio1t
trio_2t_ac

These candidates have one vote less than the other.

Type: EventTrio1t
trio_2t_ba

These candidates have one vote less than the other.

Type: EventTrio1t
trio_2t_bc

These candidates have one vote less than the other.

Type: EventTrio1t
trio_2t_ca

These candidates have one vote less than the other.

Type: EventTrio1t
trio_2t_cb

These candidates have one vote less than the other.

Type: EventTrio1t
winners

The winners.

Examples

>>> from fractions import Fraction
>>> tau = TauVector({'a': Fraction(1, 10), 'ab': Fraction(3, 5), 'c': Fraction(3, 10)})
>>> tau.winners
Winners({'a'})

Type: Winners