CultureFromProfile#
- class actinvoting.CultureFromProfile(base_profile, seed=None)[source]#
Culture deduced from an average profile.
- Parameters:
Examples
>>> profile = Profile.from_d_ranking_multiplicity({(0, 1, 2): .5, (1, 0, 2): .5}) >>> culture = CultureFromProfile(profile, seed=42) >>> culture.proba_ranking((0, 1, 2)) 0.5 >>> culture.proba_borda((2, 1, 0)) 0.5 >>> culture.random_ranking() array([1, 0, 2]) >>> culture.random_borda() array([2, 1, 0]) >>> print(culture.random_profile(n=3)) Profile((0, 1, 2): 1, (1, 0, 2): 2) >>> print(culture.average_profile) Profile((0, 1, 2): 0.5, (1, 0, 2): 0.5) >>> culture.proba_high_low(c=0, higher={1}, lower={2}) np.float64(0.5)
- 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_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