Пример #1
0
 def append_episode_metrics(self):
     self._number_of_trials_ += 1
     eval_metric = dict()
     eval_metric['completion_percentage'] = int(self._progress_)
     eval_metric['metric_time'] = int(round(time.time() * 1000))
     eval_metric['start_time'] = int(round(self._start_time_ * 1000))
     eval_metric['elapsed_time_in_milliseconds'] = \
         int(round((time.time() - self._start_time_) * 1000))
     eval_metric['trial'] = int(self._number_of_trials_)
     eval_metric['episode_status'] = EpisodeStatus.get_episode_status_label(
         self._episode_status)
     eval_metric['crash_count'] = self.reset_count_dict[
         EpisodeStatus.CRASHED.value]
     eval_metric['immobilized_count'] = self.reset_count_dict[
         EpisodeStatus.IMMOBILIZED.value]
     eval_metric['off_track_count'] = self.reset_count_dict[
         EpisodeStatus.OFF_TRACK.value]
     eval_metric['reversed_count'] = self.reset_count_dict[
         EpisodeStatus.REVERSED.value]
     eval_metric['reset_count'] = eval_metric['crash_count'] + \
                                  eval_metric['immobilized_count'] + \
                                  eval_metric['off_track_count'] + \
                                  eval_metric['reversed_count']
     self._best_lap_time = min(eval_metric['elapsed_time_in_milliseconds'],
                               self._best_lap_time)
     self._total_evaluation_time += eval_metric[
         'elapsed_time_in_milliseconds']
     self._metrics_.append(eval_metric)
Пример #2
0
 def append_episode_metrics(self):
     self._episode_ += 1 if not self._is_eval_ else 0
     self._eval_trials_ += 1 if not self._is_eval_ else 0
     training_metric = dict()
     training_metric['reward_score'] = int(round(self._episode_reward_))
     training_metric['metric_time'] = int(round(self._current_sim_time * 1000))
     training_metric['start_time'] = int(round(self._start_time_ * 1000))
     training_metric['elapsed_time_in_milliseconds'] = \
         int(round((self._current_sim_time - self._start_time_) * 1000))
     training_metric['episode'] = int(self._episode_)
     training_metric['trial'] = int(self._eval_trials_)
     training_metric['phase'] = 'evaluation' if self._is_eval_ else 'training'
     training_metric['completion_percentage'] = int(self._progress_)
     training_metric['episode_status'] = EpisodeStatus.get_episode_status_label(self._episode_status)
     self._metrics_.append(training_metric)
Пример #3
0
 def upload_episode_metrics(self):
     self._number_of_trials_ += 1
     eval_metric = dict()
     eval_metric['completion_percentage'] = int(self._progress_)
     eval_metric['metric_time'] = int(round(time.time() * 1000))
     eval_metric['start_time'] = int(round(self._start_time_ * 1000))
     eval_metric['elapsed_time_in_milliseconds'] = \
         int(round((time.time() - self._start_time_) * 1000))
     eval_metric['trial'] = int(self._number_of_trials_)
     eval_metric['episode_status'] = EpisodeStatus.get_episode_status_label(
         self._episode_status)
     self._metrics_.append(eval_metric)
     write_metrics_to_s3(self._s3_dict_[MetricsS3Keys.METRICS_BUCKET.value],
                         self._s3_dict_[MetricsS3Keys.METRICS_KEY.value],
                         self._s3_dict_[MetricsS3Keys.REGION.value],
                         self._metrics_)
     self._simtrace_data_.upload_to_s3(self._number_of_trials_)
 def append_episode_metrics(self):
     self._episode_ += 1 if not self._is_eval_ else 0
     self._eval_trials_ += 1 if not self._is_eval_ else 0
     training_metric = dict()
     training_metric["reward_score"] = int(round(self._episode_reward_))
     training_metric["metric_time"] = int(
         round(self._current_sim_time * 1000))
     training_metric["start_time"] = int(round(self._start_time_ * 1000))
     training_metric["elapsed_time_in_milliseconds"] = int(
         round((self._current_sim_time - self._start_time_) * 1000))
     training_metric["episode"] = int(self._episode_)
     training_metric["trial"] = int(self._eval_trials_)
     training_metric[
         "phase"] = "evaluation" if self._is_eval_ else "training"
     training_metric["completion_percentage"] = int(self._progress_)
     training_metric[
         "episode_status"] = EpisodeStatus.get_episode_status_label(
             self._episode_status)
     self._metrics_.append(training_metric)
 def append_episode_metrics(self, is_complete=True):
     if not is_complete and self._number_of_trials_ != 0:
         # Note: for virtual event, if the racer did not even finish one lap
         # for the duration of the event, we display DNF.
         # However, our friends at the game want the DNF ranks as well
         # so we append the incomplete metrics for ppl who didn't finish
         # first lap
         LOGGER.info(
             "Appending episode metrics for incomplete lap skipped, laps completed %s",
             self._number_of_trials_,
         )
         return
     eval_metric = dict()
     eval_metric["completion_percentage"] = int(self._progress_)
     eval_metric["metric_time"] = int(round(self._current_sim_time * 1000))
     eval_metric["start_time"] = int(round(self._start_time_ * 1000))
     eval_metric["elapsed_time_in_milliseconds"] = int(
         round((self._current_sim_time - self._start_time_) * 1000))
     eval_metric["episode_status"] = EpisodeStatus.get_episode_status_label(
         self._episode_status)
     eval_metric["crash_count"] = self.reset_count_dict[
         EpisodeStatus.CRASHED.value]
     eval_metric["immobilized_count"] = self.reset_count_dict[
         EpisodeStatus.IMMOBILIZED.value]
     eval_metric["off_track_count"] = self.reset_count_dict[
         EpisodeStatus.OFF_TRACK.value]
     eval_metric["reversed_count"] = self.reset_count_dict[
         EpisodeStatus.REVERSED.value]
     eval_metric["reset_count"] = (eval_metric["crash_count"] +
                                   eval_metric["immobilized_count"] +
                                   eval_metric["off_track_count"] +
                                   eval_metric["reversed_count"])
     if is_complete:
         self._number_of_trials_ += 1
         self._best_lap_time = min(
             eval_metric["elapsed_time_in_milliseconds"],
             self._best_lap_time)
         self._total_evaluation_time += eval_metric[
             "elapsed_time_in_milliseconds"]
     eval_metric["trial"] = int(self._number_of_trials_)
     self._metrics_.append(eval_metric)