def plot_chart(results_root_folder, show_drift_times, show_sync_times): envs=read_results_column(results_root_folder+RESULT_FILENAME,ENV_ID_COLUMN) labels=read_results_column(results_root_folder+RESULT_FILENAME,ENV_LABEL_COLUMN) index=-1 colors = ColorUtil().generateDistinctColors(len(envs)) for env in envs: index+=1 file_name=results_root_folder+'logs/communication_%s.log' % (env) if os.path.isfile(file_name): metric = read_cumulative_communication(file_name, read_number_of_rounds(results_root_folder+SUMMARY_FILENAME)) xpoints, ypoints = metric color = generate_color(index,len(envs)) color = colors[index] # if 'static-SGD' in labels[index]: # color = 'g' # if 'static-Kernel' in labels[index]: # color = 'c' # if 'dynamic-SGD' in labels[index]: # color = 'r' # if 'dynamic-Kernel' in labels[index]: # color = 'm' plt.plot(xpoints, ypoints, label = labels[index], color = color, linewidth=2.0) # if not "communication" in chart: if show_sync_times: plot_sync_times(results_root_folder, env, sync_times_marker, sync_times_size, color, xpoints, ypoints) if show_drift_times: plot_drift_times(results_root_folder)
def plot_chart(experiment_root_folder, show_drift_times, show_sync_times, loss_function): envs = read_results_column(experiment_root_folder + RESULT_FILENAME, ENV_ID_COLUMN) labels = read_results_column(experiment_root_folder + RESULT_FILENAME, ENV_LABEL_COLUMN) index = -1 max_y = 0 max_x = 0 for env in envs: index += 1 metric = read_average_error( experiment_root_folder + 'logs/prediction_%s.log' % (env), loss_function) write_metric(experiment_root_folder, metric) xpoints, ypoints = metric max_env_x = max(xpoints) max_env_y = max(ypoints) if max_env_x > max_x: max_x = max_env_x if max_env_y > max_y: max_y = max_env_y color = generate_color(index, len(envs)) plt.plot(xpoints, ypoints, label=labels[index], color=color) if show_sync_times: plot_sync_times(experiment_root_folder, env, color, (xpoints, ypoints)) plt.xlim(0, max_x) plt.ylim(0, max_y * 1.05) if show_drift_times: plot_drift_times(experiment_root_folder)