Esempio n. 1
0
def debug_ll(pc, expt, separate, voting, qs_file, indivs_file):
    data_params, inference_params, details = specific_params(separate, voting,
                                                             use_meta=True, 
                                                             know=False)
    data = wrapper.get_data(pc, expt, data_params)
    data = wrapper.process_data(data, inference_params)
    return data, calc_ll(qs_file, indivs_file, data, inference_params)
Esempio n. 2
0
def eval_old_expts(expt, folder):
    pc = "mac"
    data_params = params.SeparateData()
    inference_params = params.StatesSeparateInference()
    data = wrapper.get_data(pc, expt, data_params)
    stats = diagnostics.get_world_stats_old_expt(folder)
    diagnostics.world_probs_vs_empirical(stats, 1, data, folder + 'new/')
Esempio n. 3
0
def mh_wrapper(pc, expt, data_params, inference_params, return_stats=False, 
               results_folder='./', log_folder='./', specified_start=None):
    print(datetime.datetime.now())
    print_save_params(data_params, inference_params, results_folder)
    data = wrapper.get_data(pc, expt, data_params)
    data = wrapper.process_data(data, inference_params)
    1/0
    if inference_params.meta_noise_type == "beta":
        data['metas'] = [np.clip(m, .01, .99) for m in data['metas']]
    if expt == "generate":
        data.save_all(results_folder)
        dill.dump(data, open(results_folder + 'data.pkl', 'w'))
    if pc == "mac":
        parallel = False
    else:
        parallel = True
    lview = setup_parallel(parallel)
    if inference_params.separate:
        init_state = wrapper.make_init_for_mh(inference_params.vars_to_init,
                                              data, specified_start)
        q_results = wrapper.mh_separate(data['beliefs'], data['metas'],
                                        inference_params, lview, init_state, 
                                        results_folder, log_folder, return_stats)
        indiv_results = None
    else:
        if inference_params.num_chains > 1:
            sys.exit("Multiple chains not implemented for non-separate qs")
        results = wrapper.mh_across(data['beliefs'], data['metas'], 
                                    inference_params, lview, results_folder,
                                    log_folder, return_stats)
        q_results, indiv_results = results
    print(datetime.datetime.now())
    return q_results, indiv_results, data