Culture#
- class actinvoting.Culture(m, seed=None)[source]#
Culture: probabilistic model to generate rankings.
It is assumed here that it is a “General Independent Culture” (GIC), i.e, voters have independent preferences.
- property average_profile#
Average profile.
- Returns:
A profile where the weight for each ranking is the corresponding probability in the culture.
- Return type:
- proba_borda(borda)[source]#
Probability of a ranking, given in Borda format.
- Parameters:
borda (List) – A ranking in Borda format. E.g. [3, 1, 2, 0] corresponds to the preference ranking 0 > 2 > 1 > 3.
- Returns:
The probability to draw this ranking.
- Return type:
float or sympy expr
- proba_high_low(c, higher, lower)[source]#
Probability that a random ranking places candidate c below certain adversaries and above the other ones.
- Parameters:
c (int) – A candidate.
higher (Set) – The adversaries that should be higher than c.
lower (Set) – The adversaries that should be lower than c. Note that together, c, higher and lower must cover all the candidates.
- Returns:
Probability that for a random ranking in this culture, candidates from higher are higher than c and those from lower are lower than c.
- Return type:
- proba_ranking(ranking)[source]#
Probability of a ranking.
- Parameters:
ranking (List) – A ranking. E.g. [0, 2, 1, 3] corresponds to the preference ranking 0 > 2 > 1 > 3.
- Returns:
The probability to draw this ranking.
- Return type:
float or sympy expr
- random_borda()[source]#
Random ranking in Borda format.
- Returns:
A random ranking in Borda format. E.g. [3, 1, 2, 0] corresponds to the preference ranking 0 > 2 > 1 > 3.
- Return type:
ndarray