コード例 #1
0
        # files now
        # log.write_files()

    # print an overview of the best individuals from each run
    for i, bi in enumerate(best_inds):
        print(
            f'Run {i}: difference = {fit(bi).objective}, bin weights = {bin_weights(weights, bi)}'
        )

    # write summary logs for the whole experiment
    utils.summarize_experiment(OUT_DIR, EXP_ID)

    # read the summary log and plot the experiment
    evals, lower, mean, upper = utils.get_plot_data(OUT_DIR, EXP_ID)
    plt.figure(figsize=(12, 8))
    utils.plot_experiment(evals,
                          lower,
                          mean,
                          upper,
                          legend_name='Default settings')
    plt.legend()
    plt.show()

    # you can also plot mutiple experiments at the same time using
    # utils.plot_experiments, e.g. if you have two experiments 'default' and
    # 'tuned' both in the 'partition' directory, you can call
    # utils.plot_experiments('partition', ['default', 'tuned'],
    #                        rename_dict={'default': 'Default setting'})
    # the rename_dict can be used to make reasonable entries in the legend -
    # experiments that are not in the dict use their id (in this case, the
    # legend entries would be 'Default settings' and 'tuned')
コード例 #2
0
                f.write(f'{w} {b}\n')

        # if we used write_immediately = False, we would need to save the
        # files now
        # log.write_files()

    # print an overview of the best individuals from each run
    for i, bi in enumerate(best_inds):
        print(
            f'Run {i}: difference = {fit(bi).objective}, bin weights = {bin_weights(weights, bi)}'
        )

    # write summary logs for the whole experiment
    utils.summarize_experiment(OUT_DIR, EXP_ID)

    # read the summary log and plot the experiment
    evals, lower, mean, upper = utils.get_plot_data(OUT_DIR, EXP_ID)
    plt.figure(figsize=(12, 8))
    utils.plot_experiment(evals, lower, mean, upper, legend_name=EXP_ID)
    plt.legend()
    plt.show()

    # you can also plot mutiple experiments at the same time using
    # utils.plot_experiments, e.g. if you have two experiments 'default' and
    # 'tuned' both in the 'partition' directory, you can call
    # utils.plot_experiments('partition', ['default', 'tuned'],
    #                        rename_dict={'default': 'Default setting'})
    # the rename_dict can be used to make reasonable entries in the legend -
    # experiments that are not in the dict use their id (in this case, the
    # legend entries would be 'Default settings' and 'tuned')