Ejemplo n.º 1
0
    def evaluate_val_kalman_rollouts(self,
                                     observer,
                                     observe_data,
                                     discrete_observer,
                                     no_GP_in_observer=False,
                                     only_prior=False):
        if len(self.val_rollout_list) == 0:
            return 0

        rollout_list, rollout_RMSE, rollout_SRMSE, rollout_log_AL, \
        rollout_stand_log_AL = run_rollouts(
            self, np.array(self.val_rollout_list),
            folder=self.validation_folder, observer=observer,
            observe_data=observe_data, discrete_observer=discrete_observer,
            kalman=True, no_GP_in_observer=no_GP_in_observer,
            only_prior=only_prior)
        self.specs['val_kalman_rollout_RMSE'] = rollout_RMSE
        self.specs['val_kalman_rollout_SRMSE'] = rollout_SRMSE
        self.specs['val_kalman_rollout_log_AL'] = rollout_log_AL
        self.specs['val_kalman_rollout_stand_log_AL'] = rollout_stand_log_AL
        self.val_kalman_rollout_RMSE = \
            np.concatenate((self.val_kalman_rollout_RMSE, reshape_pt1(
                np.array([self.sample_idx, rollout_RMSE]))), axis=0)
        self.val_kalman_rollout_SRMSE = \
            np.concatenate((self.val_kalman_rollout_SRMSE, reshape_pt1(
                np.array([self.sample_idx, rollout_SRMSE]))), axis=0)
        self.val_kalman_rollout_log_AL = \
            np.concatenate((self.val_kalman_rollout_log_AL, reshape_pt1(
                np.array([self.sample_idx, rollout_log_AL]))), axis=0)
        self.val_kalman_rollout_stand_log_AL = np.concatenate(
            (self.val_kalman_rollout_stand_log_AL,
             reshape_pt1(np.array([self.sample_idx, rollout_stand_log_AL]))),
            axis=0)
        self.variables['val_kalman_rollout_RMSE'] = \
            self.val_kalman_rollout_RMSE
        self.variables['val_kalman_rollout_SRMSE'] = \
            self.val_kalman_rollout_SRMSE
        self.variables['val_kalman_rollout_log_AL'] = \
            self.val_kalman_rollout_log_AL
        self.variables['val_kalman_rollout_stand_log_AL'] = \
            self.val_kalman_rollout_stand_log_AL
        plot_val_kalman_rollout_data(self, folder=self.validation_folder)
        complete_val_rollout_list = np.concatenate(
            (self.val_rollout_list, rollout_list), axis=1)
        save_kalman_rollout_variables(
            self.validation_folder,
            len(complete_val_rollout_list),
            complete_val_rollout_list,
            step=self.step - 1,
            ground_truth_approx=self.ground_truth_approx,
            title='Val_rollouts')
Ejemplo n.º 2
0
    def evaluate_test_closedloop_rollouts(self,
                                          observer,
                                          observe_data,
                                          no_GP_in_observer=False):
        if len(self.test_rollout_list) == 0:
            return 0

        rollout_list, rollout_RMSE, rollout_SRMSE, rollout_log_AL, \
        rollout_stand_log_AL = run_rollouts(
            self, np.array(self.test_rollout_list), folder=self.test_folder,
            observer=observer, observe_data=observe_data, closedloop=True,
            no_GP_in_observer=no_GP_in_observer)
        self.specs['test_closedloop_rollout_RMSE'] = rollout_RMSE
        self.specs['test_closedloop_rollout_SRMSE'] = rollout_SRMSE
        self.specs['test_closedloop_rollout_log_AL'] = rollout_log_AL
        self.specs['test_closedloop_rollout_stand_log_AL'] = \
            rollout_stand_log_AL
        self.test_closedloop_rollout_RMSE = \
            np.concatenate((self.test_closedloop_rollout_RMSE, reshape_pt1(
                np.array([self.sample_idx, rollout_RMSE]))), axis=0)
        self.test_closedloop_rollout_SRMSE = \
            np.concatenate((self.test_closedloop_rollout_SRMSE, reshape_pt1(
                np.array([self.sample_idx, rollout_SRMSE]))), axis=0)
        self.test_closedloop_rollout_log_AL = \
            np.concatenate((self.test_closedloop_rollout_log_AL, reshape_pt1(
                np.array([self.sample_idx, rollout_log_AL]))), axis=0)
        self.test_closedloop_rollout_stand_log_AL = np.concatenate(
            (self.test_closedloop_rollout_stand_log_AL,
             reshape_pt1(np.array([self.sample_idx, rollout_stand_log_AL]))),
            axis=0)
        self.variables['test_closedloop_rollout_RMSE'] = \
            self.test_closedloop_rollout_RMSE
        self.variables['test_closedloop_rollout_SRMSE'] = \
            self.test_closedloop_rollout_SRMSE
        self.variables['test_closedloop_rollout_log_AL'] = \
            self.test_closedloop_rollout_log_AL
        self.variables['test_closedloop_rollout_stand_log_AL'] = \
            self.test_closedloop_rollout_stand_log_AL
        plot_test_closedloop_rollout_data(self, folder=self.test_folder)
        complete_test_rollout_list = np.concatenate(
            (self.test_rollout_list, rollout_list), axis=1)
        save_closedloop_rollout_variables(
            self.test_folder,
            len(complete_test_rollout_list),
            complete_test_rollout_list,
            step=self.step - 1,
            ground_truth_approx=self.ground_truth_approx,
            title='Test_rollouts')
Ejemplo n.º 3
0
    def evaluate_test_rollouts(self, only_prior=False):
        if len(self.test_rollout_list) == 0:
            return 0

        save_rollout_variables(self.test_folder,
                               len(self.test_rollout_list),
                               self.test_rollout_list,
                               step=self.step - 1,
                               results=False,
                               ground_truth_approx=self.ground_truth_approx,
                               title='Test_rollouts')
        rollout_list, rollout_RMSE, rollout_SRMSE, rollout_log_AL, \
        rollout_stand_log_AL = \
            run_rollouts(self, np.array(self.test_rollout_list),
                         folder=self.test_folder, only_prior=only_prior)
        self.specs['test_rollout_RMSE'] = rollout_RMSE
        self.specs['test_rollout_SRMSE'] = rollout_SRMSE
        self.specs['test_rollout_log_AL'] = rollout_log_AL
        self.specs['test_rollout_stand_log_AL'] = rollout_stand_log_AL
        self.test_rollout_RMSE = \
            np.concatenate((self.test_rollout_RMSE, reshape_pt1(
                np.array([self.sample_idx, rollout_RMSE]))), axis=0)
        self.test_rollout_SRMSE = \
            np.concatenate((self.test_rollout_SRMSE, reshape_pt1(
                np.array([self.sample_idx, rollout_SRMSE]))), axis=0)
        self.test_rollout_log_AL = \
            np.concatenate((self.test_rollout_log_AL, reshape_pt1(
                np.array([self.sample_idx, rollout_log_AL]))), axis=0)
        self.test_rollout_stand_log_AL = \
            np.concatenate((self.test_rollout_stand_log_AL, reshape_pt1(
                np.array([self.sample_idx, rollout_stand_log_AL]))), axis=0)
        self.variables['test_rollout_RMSE'] = self.test_rollout_RMSE
        self.variables['test_rollout_SRMSE'] = self.test_rollout_SRMSE
        self.variables['test_rollout_log_AL'] = self.test_rollout_log_AL
        self.variables['test_rollout_stand_log_AL'] = \
            self.test_rollout_stand_log_AL
        plot_test_rollout_data(self, folder=self.test_folder)
        complete_test_rollout_list = np.concatenate(
            (self.test_rollout_list, rollout_list), axis=1)
        save_rollout_variables(self.test_folder,
                               len(complete_test_rollout_list),
                               complete_test_rollout_list,
                               step=self.step - 1,
                               results=True,
                               ground_truth_approx=self.ground_truth_approx,
                               title='Test_rollouts')