def testCovStep(self): prev_cov = np.asarray([[.5, -.2], [-.2, .9]], dtype=np.float32) prev_cov_tensor = self.build_tensor(prev_cov) cov_step = build_kalman_cov_step( self.get_transition_matrix_for_timestep, self.get_transition_noise_for_timestep, self.get_observation_matrix_for_timestep, self.get_observation_noise_for_timestep) new_cov, obs_cov = cov_step((prev_cov_tensor, None), t=0) self.assertAllClose(self.evaluate(new_cov), np.dot(self.transition_matrix, np.dot(prev_cov, self.transition_matrix.T)) + np.eye(2)) self.assertAllClose(self.evaluate(obs_cov), [[np.sum(self.evaluate(new_cov)) + 1.]])
def testCovStep(self): prev_cov = np.asarray([[.5, -.2], [-.2, .9]], dtype=np.float32) prev_cov_tensor = self.build_tensor(prev_cov) cov_step = build_kalman_cov_step( self.get_transition_matrix_for_timestep, self.get_transition_noise_for_timestep, self.get_observation_matrix_for_timestep, self.get_observation_noise_for_timestep) new_cov, obs_cov = cov_step((prev_cov_tensor, None), t=0) self.assertAllClose(self.evaluate(new_cov), np.dot(self.transition_matrix, np.dot(prev_cov, self.transition_matrix.T)) + np.eye(2)) self.assertAllClose(self.evaluate(obs_cov), [[np.sum(self.evaluate(new_cov)) + 1.]])