Exemplo n.º 1
0
def run_single_simulation_for_multiprocessing(args_and_kwargs):
    args, kwargs = args_and_kwargs
    create_plots, seed, args_for_simulation = args[0], args[1], args[2:]
    set_up_logging('out.log')
    info('##### Task is:', args_and_kwargs)
    return SingleSimulationRunner(create_plots, seed).run_single_simulation(
        *args_for_simulation, **kwargs)
Exemplo n.º 2
0
        mdl_scores = [x.get_mdl() for x in result_hypotheses]
        print(f"Mean MDL: {np.mean(mdl_scores)}, std {np.std(mdl_scores)}")
        best_hypothesis_idx = np.argmin(mdl_scores)
        best_hypothesis = result_hypotheses[best_hypothesis_idx]
        best_hypothesis_dir = str(
            pathlib.Path(output_dirs[best_hypothesis_idx]).parent)
        print(f"Best hypothesis dir: {best_hypothesis_dir}")
        best_hypothesis.plot_transitions('H_best', best_hypothesis_dir)

        return total_success


if __name__ == '__main__':
    # ============> FOR REPRODUCIBILITY, YOU MUST SET PYTHONHASHSEED=0 IN ENV BEFORE RUNNING <==========
    set_up_logging('out.log')
    also_plot = True
    info(
        '-------------- STARTING BATCH OF SIMULATIONS WITH BASE SEED %s ---------'
        % _BASE_SEED)

    # run_batch(also_plot, base_seed, 'BETWEEN_WITH_DYNAMIC_UNIVERSE_SIZE', initial_temperature=100, threshold=1.0, alpha=0.99,
    #           num_simulations=10, min_set_size=5, max_set_size=30, number_of_pairs=30)

    min_set_size = 5
    max_set_size = 61
    number_of_pairs = 100
    data = make_list_of_set_pairs_for_quantifier_none(
        min_set_size=min_set_size,
        max_set_size=max_set_size,
        number_of_pairs=number_of_pairs)