コード例 #1
0
def plot_lines_from_diff_hp_searches(
    line_retrieve_inf,
    plot_dir,
    changing_hp,
    plot_parameter_names,
    metric_scales,
    xscale,
    style,
    x_select,
    model,
):
    # print(line_retrieve_inf)
    lines = retrieve_lines(line_retrieve_inf, x_select, model,
                           AVERAGING_NUMBER)
    xlabel = plot_parameter_names[changing_hp]
    create_path(plot_dir)
    plot_description_file = os.path.join(plot_dir, 'description.txt')
    with open(plot_description_file, 'w') as f:
        f.write(nested2string(line_retrieve_inf))
    for res_type, plot_data in lines.items():
        ylabel, yscale = get_y_specs(res_type, plot_parameter_names,
                                     metric_scales)
        file_name_without_ext = add_index_to_filename_if_needed(
            os.path.join(plot_dir, res_type))
        plot_outer_legend(plot_data, None, xlabel, ylabel, xscale, yscale,
                          file_name_without_ext, style)
コード例 #2
0
                x_select)
style = dict(
    no_line=args.no_line,
    error=args.error,
    marker=args.marker,
)
plot_parameter_names = get_parameter_names(args.hp_names_file)
xscale = args.xscale
metric_scales = parse_metric_scales_str(args.metric_scales)

create_path(args.plot_name, file_name_is_in_path=True)
for metric, lines_for_metric in lines_by_metrics.items():
    file_name = args.plot_name + '_' + metric
    ylabel = plot_parameter_names[metric]
    if metric in metric_scales:
        yscale = metric_scales[metric]
    else:
        yscale = 'linear'
    xlabel = args.xlabel
    description = nested2string(lines_for_metric)
    plot_outer_legend(
        lines_for_metric,
        description,
        xlabel,
        ylabel,
        xscale,
        yscale,
        file_name,
        style,
    )