def main(args): """Entry point for bootstrap""" game = gamereader.load(args.input) profiles = np.concatenate([ game.mixture_from_json(p)[None] for p in scriptutils.load_profiles(args.profiles) ]) bootf, meanf = CHOICES[args.type] results = bootf(game, profiles, args.num_bootstraps, percentiles=args.percentiles, processes=args.processes) if args.percentiles is None: args.percentiles = np.linspace(0, 100, args.num_bootstraps) percentile_strings = [ str(p).rstrip('0').rstrip('.') for p in args.percentiles ] jresults = [{p: v.item() for p, v in zip(percentile_strings, boots)} for boots in results] for jres, mix in zip(jresults, profiles): jres['mean'] = meanf(game, mix) json.dump(jresults, args.output) args.output.write('\n')
def main(args): game, serial = gameio.read_game(json.load(args.input)) prof_func = TYPE[args.type] payoffs = [prof_func(game, serial, serial.from_prof_json(prof)) for prof in scriptutils.load_profiles(args.profiles)] json.dump(payoffs, args.output) args.output.write('\n')
def main(args): """Entry point for regret cli""" game = gamereader.load(args.input) prof_func = TYPE[args.type] regrets = [prof_func(game, game.mixture_from_json(prof, verify=False)) for prof in scriptutils.load_profiles(args.profiles)] json.dump(regrets, args.output) args.output.write('\n')
def main(args): game, serial = gameio.read_game(json.load(args.input)) prof_func = TYPE[args.type] regrets = [prof_func(game, serial, serial.from_mix_json(prof, verify=False)) for prof in scriptutils.load_profiles(args.profiles)] json.dump(regrets, args.output) args.output.write('\n')
def main(args): game, serial = gameio.read_sample_game(json.load(args.input)) profiles = np.concatenate([serial.from_prof_json(p)[None] for p in scriptutils.load_profiles(args.profiles)]) bootf, meanf = CHOICES[args.type] results = bootf(game, profiles, args.num_bootstraps, args.percentiles, args.processes) if args.percentiles is None: args.percentiles = np.linspace(0, 100, args.num_bootstraps) percentile_strings = [str(p).rstrip('0').rstrip('.') for p in args.percentiles] jresults = [{p: v.item() for p, v in zip(percentile_strings, boots)} for boots in results] if args.mean: for jres, mix in zip(jresults, profiles): jres['mean'] = meanf(game, mix) json.dump(jresults, args.output) args.output.write('\n')