Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing test for AKKF proposal multivariate sampling to compare mean of particle state #1057

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions stonesoup/predictor/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@


class AdaptiveKernelKalmanPredictor(KalmanPredictor):
r"""An implementation of the adaptive kernel Kalman filter (AKKF) predictor. Here, the AKKF draws
inspiration from the concepts of kernel mean embeddings (KME) and Kalman Filter to address
tracking problems in nonlinear systems.
r"""An implementation of the adaptive kernel Kalman filter (AKKF) predictor. Here, the AKKF
draws inspiration from the concepts of kernel mean embeddings (KME) and Kalman Filter to
address tracking problems in nonlinear systems.

In the state space, at time :math:`k`, the prior state
particles are generated by passing the proposal particles at time :math:`k-1`, i.e.,
Expand Down
1 change: 0 additions & 1 deletion stonesoup/predictor/tests/test_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from ...types.update import KernelParticleStateUpdate

number_particles = 4
np.random.seed(50)
timestamp = datetime.datetime.now()
samples = multivariate_normal.rvs([0, 0, 0, 0],
np.diag([0.01, 0.005, 0.1, 0.5])**2,
Expand Down
1 change: 0 additions & 1 deletion stonesoup/types/tests/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,6 @@ def test_asd_weighted_gaussian_state():
def test_kernel_particle_state():
number_particles = 5
weights = np.array([1 / number_particles] * number_particles)
np.random.seed(50)

samples = multivariate_normal.rvs([0, 0, 0, 0],
np.diag([0.01, 0.005, 0.1, 0.5]) ** 2,
Expand Down
6 changes: 4 additions & 2 deletions stonesoup/updater/tests/test_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
new_timestamp = timestamp + time_diff

number_particles = 5
np.random.seed(50)
samples = multivariate_normal.rvs([0, 0, 0, 0],
np.diag([0.01, 0.005, 0.1, 0.5])**2,
size=number_particles)
Expand Down Expand Up @@ -107,7 +106,10 @@ def test_kernel_updater(kernel, measurement_model, c, ialpha):
assert measurement.timestamp == gt_state.timestamp
assert update.hypothesis.measurement.timestamp == gt_state.timestamp
assert np.allclose(update.state_vector, prediction.state_vector)
assert np.allclose(update.proposal, StateVectors(new_state_vector.T), atol=1e0)
assert np.allclose(
np.mean(update.proposal, axis=1),
np.mean(StateVectors(new_state_vector.T), axis=1),
atol=2)
assert np.allclose(update.weight, updated_weights.ravel())
assert np.allclose(update.kernel_covar, updated_covariance)

Expand Down