#plt.scatter([x1, car_x2], [y1, car_y2], color=action_color, s=action_s, alpha=0.65) plt.scatter(x1, y1, color=action_color, s=action_s, alpha=0.75) # - # # Action Space Visualization # + jupyter={"source_hidden": true} plot_index_map(asl) # - # # Analysing data from all episodes # + jupyter={"source_hidden": true} tr_plot = pu.plot_track(df, track, value_field="reward") # + jupyter={"source_hidden": true} plot_4_hist(df) # + jupyter={"source_hidden": true} plot_polar_hist(df) # - # # # # Analyzing specific iteration # # # #
# Disproportion means you may have one reward of 10.000 and the rest in range 0.01-1. # In such cases the vast majority of dots will simply be very dark and the only bright dot # might be in a place difficult to spot. I recommend you go back to the tables and show highest # and average rewards per step to confirm if this is the case. Such disproportions may # not affect your traning very negatively, but they will make the data less readable in this notebook. # # Sparse data means that the car gets a high reward for the best behaviour and very low reward # for anything else, and worse even, reward is pretty much discrete (return 10 for narrow perfect, # else return 0.1). The car relies on reward varying between behaviours to find gradients that can # lead to improvement. If that is missing, the model will struggle to improve. # + #If you'd like some other colour criterion, you can add #a value_field parameter and specify a different column pu.plot_track(df, track) # - # ### Plot a particular iteration # This is same as the heatmap above, but just for a single iteration. # + #If you'd like some other colour criterion, you can add #a value_field parameter and specify a different column iteration_id = 3 pu.plot_track(df[df['iteration'] == iteration_id], track) # - # ### Path taken in a particular episode
simulation_agg.groupby('iteration')['progress'].mean() # ### Plot a training progress by quintiles au.scatter_by_groups(simulation_agg, title='Quintiles') au.scatter_by_groups(complete_ones, title='Quintiles') #If you'd like some other colour criterion, you can add #a value_field parameter and specify a different column #pu.plot_track(df[df['iteration']>80], track) df_scaled = df df_scaled.loc[df_scaled['progress']==100,'reward']=0 # df_scaled=df_scaled[df_scaled['iteration']>100] pu.plot_track(df_scaled, track) # ## Data in tables # View ten best rewarded episodes in the training simulation_agg.nlargest(10, 'reward').T # View five fastest complete laps print('Total number of episodes ',max(simulation_agg['episode'])) complete_ones.nsmallest(10, 'time').T # ### Path taken and throttle values in a particular episode episode_id = simulation_agg[simulation_agg['progress']==100]['time'].idxmin() print('Fastest episode number: ' "{:0.0f}".format(episode_id)) print('Lap time: ' "{:0.2f}".format(float(simulation_agg[simulation_agg['episode']==episode_id]['time'])))