min_avgs[env_key] = data['avg'][index] min_stds[env_key] = data['std'][index] for env_key in env_keys: ps[env_key] = sorted(ps[env_key]) avgs[env_key] = np.array([avgs[env_key][p] for p in ps[env_key]]) stds[env_key] = np.array([stds[env_key][p] for p in ps[env_key]]) os.chdir(cwd) return env_keys, ps, avgs, stds, min_avgs, min_stds if __name__ == '__main__': env_keys, ps, avgs, stds, min_avgs, min_stds = load_data('nn') colors = [graphs.BLUE, graphs.PINK, graphs.GREEN] graphs.output_file('c4_fig4_2_mbratio_perf.html') env_displayed = [env_key for env_key in env_keys if env_key[0] == 'kin20_150' and env_key[2] == 10000] for color, envd in zip(colors, env_displayed): print(avgs[envd]) y_max = max(avgs[envd] + stds[envd]) graphs.perf_std_discrete(ps[envd], avgs[envd], stds[envd], std_width=0.0035, color=color, y_range=[0.0, y_max+0.02], plot_width=1000, plot_height=500, title='{} {}'.format(*envd)) graphs.hold(True) graphs.show()
ratios[tick].append(ratios_[i]) avgs[tick].append(src_data[0]['avg'][index]) stds[tick].append(src_data[0]['std'][index]) y_max = max(y_max, max(avgs[tick]) + max(stds[tick])) except ValueError: pass os.chdir(cwd) if __name__ == "__main__": print(' '.join('{:6.3f}|{:6.3f}'.format(a, s) for a, s in zip(avgs, stds))) graphs.output_file('c3_fig3_8_unreach_perf.html') colors = ['#2577B2', '#E84A5F'] for color, tick in zip(colors, [2000, 10000]): graphs.perf_std_discrete( ratios[tick], avgs[tick], stds[tick], std_width=0.25, color=color, alpha=0.75, y_range=[0.0, y_max + 0.01], #y_range=[y_min-0.1, y_max+0.1], plot_width=1000, plot_height=400, title='t={}'.format(tick)) graphs.hold(True) graphs.show()
# for N in Ns: # for w in windows: # print('N={}, w={} : {} +- {}'.format(N, w, adapt_avgs[(w, N, 20)], adapt_stds[(w, N, 20)])) # print() if __name__ == '__main__': graphs.output_file('c4_figB_4_adaptg_reach_graph.html') for res in RESS: for N in Ns: y_max = max(np.array(avgs[N]) + np.array(stds[N])) graphs.perf_std_discrete(ratios[N], avgs[N], stds[N], color='#2577B2', alpha=0.5, y_range=[0, y_max * 1.05], title='adaptg_reach, t={}, res={}'.format( N, res), std_width=0.25, plot_width=1000, plot_height=300) graphs.hold(True) graphs.line([0, 100], adapt_avgs[(W, N, res)], adapt_stds[(W, N, res)]) graphs.hold(False) graphs.show()
# for d in disturbs: # for N in Ns: # print('N={}: {} +- {}'.format(N, adapt_avgs[(d, res, N)], adapt_stds[(d, res N)])) if __name__ == '__main__': graphs.output_file('c4_fig4_5_adapt_graph_{}.html'.format(KIND)) y_ranges = [(0.075, 0.3), (0.0, 0.1), (0.08, 0.14)] for i, d in enumerate(disturbs): y_range = y_ranges[i] for N in Ns: for res in RESS: graphs.perf_std_discrete( [100 * i * 0.05 for i in range(21)], avgs[('kin20_150', d, N)], stds[('kin20_150', d, N)], std_width=0.25, color='#2577B2', alpha=0.5, y_range=y_range, #y_range=[y_min-0.1, y_max+0.1], plot_width=1000, plot_height=300, title='d={} t={} res={}'.format(d, N, res)) graphs.hold(True) graphs.line([0, 100], adapt_avgs[(d, res, N)], adapt_stds[(d, res, N)]) graphs.hold(False) graphs.show()
min_avgs[env_key] = data['avg'][index] min_stds[env_key] = data['std'][index] for env_key in env_keys: ps[env_key] = sorted(ps[env_key]) avgs[env_key] = np.array([avgs[env_key][p] for p in ps[env_key]]) stds[env_key] = np.array([stds[env_key][p] for p in ps[env_key]]) os.chdir(cwd) return env_keys, ps, avgs, stds, min_avgs, min_stds if __name__ == '__main__': env_keys, ps, avgs, stds, min_avgs, min_stds = load_data('nn') colors = [graphs.BLUE, graphs.PINK, graphs.GREEN] graphs.output_file('fixed_graph.html') env_displayed = [env_key for env_key in env_keys if env_key[0] == 'kin20_150' and env_key[2] == 5000] for color, envd in zip(colors, env_displayed): print(avgs[envd]) y_max = max(avgs[envd] + stds[envd]) graphs.perf_std_discrete(ps[envd], avgs[envd], stds[envd], std_width=0.0035, color=color, y_range=[0.0, y_max+0.02], plot_width=1000, plot_height=500, title='{} {}'.format(*envd)) graphs.hold(True) graphs.show()
batch = jobfactory.make_jobgroup([exp_cfg]) os.chdir(os.path.expanduser(exp_cfg.meta.rootpath)) data = hub.ResultsHub(batch, kind='nn').data()[0] window = exp_cfg.exploration.explorer.ex_1.window for N in Ns: index = data['ticks'].index(N) adapt_avgs[(window, N)] = data['avg'][index] adapt_stds[(window, N)] = data['std'][index] os.chdir(cwd) for N in Ns: for w in windows: print('N={}, w={} : {} +- {}'.format(N, w, adapt_avgs[(w, N)], adapt_stds[(w, N)])) print() if __name__ == '__main__': graphs.output_file('c4_fig4_9_adapt_reach_graph.html') for N in Ns: y_max = max(np.array(avgs[N]) + np.array(stds[N])) graphs.perf_std_discrete(ratios[N], avgs[N], stds[N], std_width=0.25, alpha=0.5, y_range=[0, y_max*1.05], title='adaptative reach performance, t = {}'.format(N)) graphs.hold(True) graphs.line([0, 100], adapt_avgs[(W, N)], adapt_stds[(W, N)]) graphs.hold(False) graphs.show()
ex_name = exp_cfg.exp.explorer_name dims.setdefault(ex_name, []) avgs.setdefault(ex_name, []) stds.setdefault(ex_name, []) dims[ex_name].append(dim) avgs[ex_name].append(data['avg'][-1]) stds[ex_name].append(data['std'][-1]) y_max = max(y_max, data['avg'][-1] + data['std'][-1]) os.chdir(cwd) colors = ['#2577B2', '#E84A5F'] graphs.output_file('c3_fig3_3_eval_perf.html') for color, ex_name in zip(colors, dims.keys()): graphs.perf_std_discrete(dims[ex_name], avgs[ex_name], stds[ex_name], std_width=0.25, color=color, title=str(ex_name), x_range=[0.0, 110.0], y_range=[0.0, y_max + 0.1], plot_width=1000, plot_height=300) graphs.hold(True) graphs.show()
n_motor = exp_cfg.exploration.explorer.eras[0] env = env_name d = exp_cfg.exploration.explorer.ex_1.learner.m_disturb try: disturb[env].append(d) avgs[env][d] = src_data[0]['avg'][-1] stds[env][d] = src_data[0]['std'][-1] except ValueError: pass env_displayed = ['kin2_150', 'kin7_150', 'kin20_150'] for env_name in env_displayed: disturb[env_name] = sorted(disturb[env_name]) avgs[env_name] = np.array([avgs[env_name][d] for d in disturb[env_name]]) stds[env_name] = np.array([stds[env_name][d] for d in disturb[env_name]]) y_max = max(y_max, max(avgs[env_name] + stds[env_name])) os.chdir(cwd) colors = ['#2577B2', '#E84A5F'] graphs.output_file('c3_fig3_14_inverse_perf.html') for env_name in env_displayed: x = [math.log(d) for d in disturb[env_name]] graphs.perf_std_discrete(x, avgs[env_name], stds[env_name], std_width=0.02, y_range=[0.0, 0.3], title=str(env_name), plot_width=1000, plot_height=300) graphs.show()
for N in Ns: index = data['ticks'].index(N) adapt_avgs[(d, N)] = data['avg'][index] adapt_stds[(d, N)] = data['std'][index] os.chdir(cwd) for d in disturbs: for N in Ns: print('N={}: {} +- {}'.format(N, adapt_avgs[(d, N)], adapt_stds[(d, N)])) if __name__ == '__main__': graphs.output_file('ddmab_graph.html') y_ranges=[(0.075, 0.3), (0.0, 0.1), (0.08, 0.14)] for i, d in enumerate(disturbs): y_range = y_ranges[i] for N in Ns: graphs.perf_std_discrete([100*i*0.05 for i in range(21)], avgs[('kin20_150', d, N)], stds[('kin20_150', d, N)], std_width=0.25, alpha=0.5, y_range=y_range, plot_height=300, title='d={} t={}'.format(d, N)) graphs.hold(True) graphs.line([0, 100], adapt_avgs[(d, N)], adapt_stds[(d, N)]) graphs.hold(False) graphs.show()
adapt_avgs[(d, N)] = data['avg'][index] adapt_stds[(d, N)] = data['std'][index] os.chdir(cwd) for d in disturbs: for N in Ns: print('N={}: {} +- {}'.format(N, adapt_avgs[(d, N)], adapt_stds[(d, N)])) if __name__ == '__main__': graphs.output_file('c4_fig4_5_adapt_graph_{}.html'.format(KIND)) y_ranges = [(0.075, 0.3), (0.0, 0.1), (0.08, 0.14)] for i, d in enumerate(disturbs): y_range = y_ranges[i] for N in Ns: graphs.perf_std_discrete([100 * i * 0.05 for i in range(21)], avgs[('kin20_150', d, N)], stds[('kin20_150', d, N)], std_width=0.25, alpha=0.5, y_range=y_range, plot_height=300, title='d={} t={}'.format(d, N)) graphs.hold(True) graphs.line([0, 100], adapt_avgs[(d, N)], adapt_stds[(d, N)]) graphs.hold(False) graphs.show()