Пример #1
0
def bootstrap_experiment(base_game_func, noise_model, statistic=regret, \
		num_games=1000, stdevs=[1.,10.,100.], sample_sizes=[5,10,20, \
		50,100,200,500], equilibrium_search=mixed_nash, bootstrap_args=[]):
	results = [{s:{} for s in stdevs} for i in range(num_games)]
	for i in range(num_games):
		base_game = base_game_func()
		RG.rescale_payoffs(base_game, 0, 100)
		for stdev in stdevs:
			sample_game = RG.add_noise(base_game, noise_model, stdev, \
									sample_sizes[-1])
			for sample_size in sample_sizes:
				subsample_game = subsample(sample_game, sample_size)
				equilibria = equilibrium_search(subsample_game)
				results[i][stdev][sample_size] = [ \
					{ \
						"profile" : eq,
						"statistic" : statistic(base_game, eq),
						"bootstrap" : bootstrap(subsample_game, eq, statistic, \
												*bootstrap_args)
					} for eq in equilibria]
	return results
Пример #2
0
def construct_game(input):
    options = input.get('options', {})
    if input['type'] == 'local_effect':
        game = RandomGames.local_effect_game(**options)
        RandomGames.rescale_payoffs(game)
    elif input['type'] == 'congestion':
        game = RandomGames.congestion_game(**options)
        RandomGames.rescale_payoffs(game)
    elif input['type'] == 'uniform':
        game = RandomGames.uniform_symmetric_game(**options)
        RandomGames.rescale_payoffs(game)
    elif input['type'] == 'file':
        game = Reductions.deviation_preserving_reduction(GameIO.read(input['file']), {'All': 6})
    return game