Perform resampling as first update step to avoid plotting issue

This commit is contained in:
2019-10-01 14:56:17 +02:00
parent 2668cfc600
commit d96af81109

View File

@@ -134,6 +134,8 @@ namespace SMC {
Assert::isNotNull(evaluation, "evaluation MUST not be null! call setEvaluation() first!"); Assert::isNotNull(evaluation, "evaluation MUST not be null! call setEvaluation() first!");
Assert::isNotNull(estimation, "estimation MUST not be null! call setEstimation() first!"); Assert::isNotNull(estimation, "estimation MUST not be null! call setEstimation() first!");
// if the number of efficient particles is too low, perform resampling
if (lastNEff < particles.size() * nEffThresholdPercent) { resampler->resample(particles); }
// perform the transition step // perform the transition step
@@ -153,9 +155,6 @@ namespace SMC {
// estimate the current state // estimate the current state
const State est = estimation->estimate(particles); const State est = estimation->estimate(particles);
// if the number of efficient particles is too low, perform resampling
if (lastNEff < particles.size() * nEffThresholdPercent) {resampler->resample(particles); }
// done // done
return est; return est;