def update_costs_plot(self, experiment, version, checkpoint, episode): speeds = DataReader.get_episode_speeds( experiment, version, checkpoint, episode ) self.costs_plot_figure.title = f"Costs and speed: episode {episode}" if speeds is not None: self.costs_plot_lines_speed.x = range(len(speeds)) self.costs_plot_lines_speed.y = speeds self.costs_plot_lines_speed.labels = ["speed"] costs = DataReader.get_episode_costs( experiment, version, checkpoint, episode ) if costs is not None: x = costs.index self.x_sc.min = x[0] self.x_sc.max = x[-1] self.costs_plot_lines_costs.x = x self.costs_plot_lines_costs.y = [ costs["lane_cost"], costs["pixel_proximity_cost"], costs["collisions_per_frame"], ] self.costs_plot_lines_costs.labels = [ "lane cost", "pixel proximity cost", "collisions per frame", ]
def get_episode_features(experiment, seed, checkpoint, episode): """ Get features for one episode This is used for dimensionality reduction, which is later used for scatter plotting. """ history_size = 10 features = [] features.append( DataReader.get_episode_speeds(experiment, seed, checkpoint, episode)[-history_size:]) costs = DataReader.get_episode_costs(experiment, seed, checkpoint, episode) columns_to_save = [ 'proximity_cost', 'lane_cost', 'pixel_proximity_cost' ] for column in columns_to_save: features.append(costs[column].to_numpy()[-history_size:]) features = np.stack(features) features = features.flatten() return features
def update_costs_plot(self, experiment, seed, checkpoint, episode): speeds = DataReader.get_episode_speeds(experiment, seed, checkpoint, episode) self.costs_plot_figure.title = f'Costs and speed: episode {episode}' if speeds is not None: self.costs_plot_lines_speed.x = range(len(speeds)) self.costs_plot_lines_speed.y = speeds self.costs_plot_lines_speed.labels = ['speed'] costs = DataReader.get_episode_costs(experiment, seed, checkpoint, episode) if costs is not None: x = costs.index self.x_sc.min = x[0] self.x_sc.max = x[-1] self.costs_plot_lines_costs.x = x self.costs_plot_lines_costs.y = [ costs['lane_cost'], costs['pixel_proximity_cost'], costs['collisions_per_frame'] ] self.costs_plot_lines_costs.labels = [ 'lane cost', 'pixel proximity cost', 'collisions per frame' ]