Ejemplo n.º 1
0
                    type=str,
                    default="",
                    help='title of the chart')
parser.add_argument('--bounds',
                    dest='bounds',
                    type=str,
                    help='Y-bounds lower:upper[:step[:minor_step]]')
args = parser.parse_args()

input_files = os.path.join(args.input, "*")
output_chart = get_chart_path(args.input, args.output)
chart_bounds = None if args.bounds is None else tuple(
    [float(x) for x in args.bounds.split(":")])
output_xlsx = get_xlsx_path(args.input, args.output)

data = get_data_on_imdbwiki(input_files=input_files)

pretty_data_print(data)

print("Saving chart...")
save_bar_chart(output_chart,
               data,
               y_label="",
               title=args.title,
               bounds=chart_bounds)
print("Chart {} saved!".format(output_chart))

print("Saving XLSX...")
write_xlsx(output_xlsx, data)
print("XLSX {} saved!".format(output_xlsx))
data = get_data_on_adience_score(input_files=input_files)

# Combined top-one and one-off avgs
print("Elaborating combined chart...")
avg_data = defaultdict(dict)
for model_name, model_data in data.items():
    for score_type, folds_dict in model_data.items():
        avg_data[model_name][score_type] = folds_dict['fold_avg']

pretty_data_print(avg_data)

print("Saving chart...")
save_bar_chart(output_chart,
               avg_data,
               y_label="",
               title=args.title,
               bounds=chart_bounds)
print("Chart {} saved!".format(output_chart))

print("Saving XLSX...")
write_xlsx(output_xlsx, avg_data)
print("XLSX {} saved!".format(output_xlsx))

# Only top-one avg
print("Elaborating Top-1 chart...")
top_one_data = defaultdict(dict)
for model_name, model_data in data.items():
    top_one_data[model_name]["Top-one score"] = model_data["Top-one score"][
        'fold_avg']