monte_carlo_fictitious_play

poisson_approval.meta_analysis.monte_carlo_fictitious_play.monte_carlo_fictitious_play(factory, n_samples, n_max_episodes, voting_rules=None, init='sincere', perception_update_ratio=<function one_over_log_t_plus_one>, ballot_update_ratio=<function one_over_log_t_plus_one>, statistics_update_ratio=<function one_over_log_t_plus_one>, monte_carlo_settings=None, file_save=None, meth='fictitious_play')[source]

Monte-Carlo analysis of fictitious play (or iterated voting).

Parameters
  • factory (callable) – A factory that returns a (random) profile. Cf. e.g. RandProfileHistogramUniform, etc.

  • n_samples (int) – The number of profiles drawn.

  • n_max_episodes (int) – Maximum number of episodes for the fictitious play / iterated voting.

  • voting_rules (list) – A list of voting rules. Each profile drawn is analyzed with each voting rule. If None, then use the voting rule of the profile returned by factory.

  • init (Strategy or TauVector or str) – Cf. fictitious_play() or iterated_voting().

  • perception_update_ratio (callable or Number) – Cf. fictitious_play() or iterated_voting().

  • ballot_update_ratio (callable or Number) – Cf. fictitious_play() or iterated_voting().

  • statistics_update_ratio (callable or Number) – Cf. fictitious_play() or iterated_voting().

  • monte_carlo_settings (list of MonteCarloSetting) – Roughly speaking, this gives the information of which statistics will be computed. Cf. MonteCarloSetting for more details.

  • file_save (str) – Name of the file where the results will be stored (using pickle).

  • meth (str) – The name of the method ('fictitious_play' or 'iterated_voting').

Returns

Key: voting rule (or '' if voting_rule is None). Value: a dictionary whose keys are keywords for the computed statistics, and whose values are the corresponding outputs. Cf. MonteCarloSetting.

Return type

dict

Examples

>>> meta_results = monte_carlo_fictitious_play(
...     factory=RandProfileHistogramUniform(n_bins=1),
...     n_samples=1,
...     n_max_episodes=10,
...     voting_rules=VOTING_RULES,
...     monte_carlo_settings=[
...         MCS_PROFILE,
...         MCS_TAU_INIT,
...         MCS_N_EPISODES,
...         MCS_CANDIDATE_WINNING_FREQUENCY,
...         MCS_CONVERGES,
...         MCS_FOCUS,
...         MCS_IS_ORDINAL_EQ,
...         MCS_FREQUENCY_CW_WINS,
...         MCS_WELFARE_LOSSES,
...         MCS_UTILITY_THRESHOLDS,
...         MCS_BALLOT_STATISTICS,
...         MCS_DECREASING_SCORES,
...     ],
... )
class poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting(statistics_tau=None, statistics_strategy=None, statistics_post_processing=None, statistics_final_processing=None)[source]

A setting for monte_carlo_fictitious_play().

Parameters
  • statistics_tau (dict) – Key: name of the statistic. Value: a function whose input is a tau-vector, and whose output is a number or a numpy array. This parameter is passed to the argument other_statistics_tau of iterated_voting() or fictitious_play(). For each voting rule and each profile, the long-run average of the statistic is computed, then stored in a list of length n_samples. This list is accessible by meta_results[voting_rule][name_of_the_statistic] (where meta_results denotes the results of monte_carlo_fictitious_play()).

  • statistics_strategy (dict) – Key: name of the statistic. Value: a function whose input is a strategy, and whose output is a number or a numpy array. This parameter is passed to the argument other_statistics_strategy of iterated_voting() or fictitious_play(). For each voting rule and each profile, the long-run average of the statistic is computed, then stored in a list of length n_samples. This list is accessible by meta_results[voting_rule][name_of_the_statistic].

  • statistics_post_processing (dict) – Key: name of the statistic. Value: a function whose input is a pair (results, profile). Such a statistic is computed only once for each voting rule and each profile, after iterated voting or fictitious play has ended. Results are stored in a list of length n_samples, which is accessible by meta_results[voting_rule][name_of_the_statistic].

  • statistics_final_processing (dict) – Key: name of the statistic. Value: a function whose input is the meta_result already computed so far. Such a statistic is computed only once for each voting rule, after the whole process is finished. It is accessible by meta_results[voting_rule][name_of_the_statistic].

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_BALLOT_STATISTICS = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Ballot statistics.

Keyword 'share_single_votes': share of single votes (for each profile).

Keyword 'share_double_votes': share of double votes (for each profile).

Keyword 'share_sincere_votes': share of sincere votes (for each profile).

Keyword 'share_insincere_votes': share of insincere votes (for each profile).

Keywords 'mean_share_single_votes', 'mean_share_double_votes', 'mean_share_sincere_votes', 'mean_share_insincere_votes': corresponding average shares (over all profiles).

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_CANDIDATE_WINNING_FREQUENCY = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Candidates’ winning frequencies.

Keyword 'd_candidate_winning_frequency': winning frequency for each candidate (for each profile).

Keyword 'd_candidate_mean_winning_frequency': average winning frequency for each candidate (over all profiles).

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_CONVERGES = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Convergence.

Keyword 'converges': whether the procedure converges (for each profile).

Keyword 'mean_converges': rate of convergence (over all profiles).

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_FOCUS = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Focus of the equilibrium.

Keyword 'focus': focus of the equilibrium, or None if no convergence (for each profile).

Keyword 'focus_stats': dictionary. Key: a focus or None. Value: proportion of profiles.

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_IS_ORDINAL_EQ = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Whether the equilibrium is ordinal.

Keyword 'ordinal_eq': whether the equilibrium is ordinal, or None if no convergence (for each profile).

Keyword 'ordinal_eq_stats': dictionary. Key: true (ordinal), false (cardinal) or None (no convergence). Value: proportion of profiles.

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_DECREASING_SCORES = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Decreasing scores.

Keyword 'decreasing_scores': scores of the candidates, in decreasing order (for each profile).

Keyword 'score_winner': score of the winner (for each profile).

Keyword 'score_second': score of the second candidate (for each profile).

Keyword 'score_loser': score of the loser (for each profile).

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_FREQUENCY_CW_WINS = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Winning frequency of the Condorcet winner.

Keyword 'frequency_cw_wins': winning frequency of the Condorcet winner (for each profile).

Keyword 'mean_frequency_cw_wins': average winning frequency of the Condorcet winner (over all profiles).

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_N_EPISODES = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Number of episodes.

Keyword 'n_episodes': the number of episodes (for each profile).

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_PROFILE = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Profile.

Keyword 'profile': the profile (for each profile).

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_TAU_INIT = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Tau-vector used at initialization.

Keyword 'tau_init': the tau-vector used at initialization (for each profile).

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_UTILITY_THRESHOLDS = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Utility thresholds.

Keyword 'weights_rankings': weights of each ranking (for each profile).

Keyword 'utility_thresholds': utility threshold of each ranking (for each profile).

Keyword 'p_utility_threshold_0': probability of having a utility threshold equal to 0 (over all profiles and rankings).

Keyword 'p_utility_threshold_1': probability of having a utility threshold equal to 1 (over all profiles and rankings).

Keyword 'p_utility_threshold_not_0_or_1': probability of having a utility threshold different from 0 or 1 (over all profiles and rankings).

Type

MonteCarloSetting

poisson_approval.meta_analysis.monte_carlo_fictitious_play.MCS_WELFARE_LOSSES = <poisson_approval.meta_analysis.monte_carlo_fictitious_play.MonteCarloSetting object>

Welfare losses.

Keyword 'candidate_winning_frequencies': winning frequency of each candidate (for each profile).

Keyword 'utilitarian_welfare_losses': utilitarian welfare loss (for each profile).

Keyword 'plurality_welfare_losses': plurality welfare loss (for each profile).

Keyword 'anti_plurality_welfare_losses': anti-plurality welfare loss (for each profile).

Keyword 'mean_utilitarian_welfare_loss': average utilitarian welfare loss (over all profiles).

Keyword 'mean_plurality_welfare_loss': average plurality welfare loss (over all profiles).

Keyword 'mean_anti_plurality_welfare_loss': average anti-plurality welfare loss (over all profiles).

Type

MonteCarloSetting