def plt_pob_siz_results(plt_file_name = None): mdl_name = "list_len_mdl.h5" opt = Options() pob_siz_len = np.arange(start=3, stop=11,step=2) #not even steps needed # pob_siz_len =[5,3,5,9,1] results_success_rate_map_zero = [] results_astar_diff = [] for p in pob_siz_len: opt.pob_siz = p opt.state_siz = (p * opt.cub_siz) ** 2 print("start with opt.pob_siz: {}".format(opt.pob_siz)) print("start with opt.state_siz: {}".format(opt.state_siz)) map_ind = opt.map_ind opt.map_ind = 0 get_data(opt)#generaten new data with the map 0 opt.map_ind = map_ind train_model(opt, mdl_name, epochs=EPOCHS) [success_rate, astar_diff] = test_model(opt,mdl_name) results_success_rate_map_zero.append(success_rate) results_astar_diff.append(astar_diff) # Four polar axes f, axarr = plt.subplots(1,2) axarr[0].scatter(pob_siz_len, results_success_rate_map_zero) axarr[0].set_ylabel(r'success rate',usetex=True) axarr[1].scatter(pob_siz_len, results_astar_diff) # axarr[1].set_title('difference to astar in number of steps') axarr[1].set_ylabel(r'mean difference to astar in steps',usetex=True) axarr[0].set_xlabel(r'view size',usetex=True) axarr[1].set_xlabel(r'view size',usetex=True) helper_save(plt_file_name)
# results_astar_diff.append(astar_diff) results_success_rate_map_zero=np.array(results_success_rate_map_zero) plt.imshow(results_success_rate_map_zero.reshape(len(pob_siz_len),len(hist_len)), cmap='hot', interpolation='nearest') plt.colorbar() # plt.show() helper_save(plt_file_name) if __name__ == "__main__": #change opt.change_tgt = True #rand goal pos if true #change opt.map_ind = 1/0 for the differnt map opt = Options() with K.get_session(): # history len vs success rate and mean difference to astar opt.map_ind = 1 #map for test opt.change_tgt = False plt_hist_len_results("hist_len_fixedGoal_map1_pobSiz5") opt.map_ind = 1 opt.change_tgt = True plt_hist_len_results("hist_len_randGoal_map1_pobSiz5") opt.map_ind = 0 opt.change_tgt = True plt_hist_len_results("hist_len_randgoal_map0_pobSiz5") opt.map_ind = 0 opt.change_tgt = False plt_hist_len_results("hist_len_fixedgoal_map0_pobSiz5") # #plt_hist_len_results("hist_len_fixed_goal_rand_goal_in_test_map_0_pob_siz_5") # opt.map_ind = 1