|
EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
|
Action that moves each particle by an independent draw from a Gaussian kernel, to restore the diversity resampling removes: the regularized particle filter. More...
#include <EmrysFilter/Distributions/Upkeep.h>
Public Member Functions | |
| constexpr | Roughen (G &generator, Scalar_ scale=1, Policy_ policy={}) |
| Draws from generator a kernel of covariance scale times the bandwidth, under policy. | |
| template<typename Space, typename Scalar, typename Allocator> | |
| std::expected< bool, WeightError > | operator() (ParticleSet< Space, Scalar, Allocator > &particles) const |
| Moves each of particles by a draw from the kernel. | |
| template<typename State> requires requires(State & state) { state.setParticleStates(state.particles().states()); } | |
| std::expected< bool, WeightError > | operator() (State &state) const |
| Roughens the particles of a Rao-Blackwellized state, such as a ParticleGaussianParams, by their own bandwidth. | |
| constexpr G & | generator () const noexcept |
| constexpr Scalar_ | scale () const noexcept |
| constexpr Policy_ const & | policy () const noexcept |
Action that moves each particle by an independent draw from a Gaussian kernel, to restore the diversity resampling removes: the regularized particle filter.
The kernel's covariance is scale times the set's kdeBandwidth(), Silverman's rule unless a bandwidth is stored, so after an equal-weight resample the particles become a draw from their kernel density estimate. resample() clears a stored bandwidth, so one stored before it is not used after it. A smaller scale adds less noise than the estimate would. The draws are added in the tangent space and normalized. A stored bandwidth is kept, as it is when the states change other than by resampling. Scalar_ is the type of scale, deduced from the one given (upkeep::roughen(rng, 0.25f) holds a float), so that a float filter holds no double. A scale of zero turns roughening off: upkeep::roughen(rng, 0) checks the weights and returns false, drawing nothing from the generator and leaving the states as they were, so that a run with it is the run without it.
The action draws from the generator G, which it holds by reference and which must outlive it, under the execution policy Policy_ (sequential by default): the bandwidth is a reduction over the particles, and the moves are a for-each over them (see Execution policies). Sequential draws each particle's normals as it moves it, so it allocates nothing; another policy draws them all first, in the same order, into scratch from the policy [execution-policies].
The weights need not be equal: Silverman's rule weights by the effective sample size, so roughening before a resample takes the weighted spread.
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscard |
Moves each of particles by a draw from the kernel.
|
inlinenodiscard |
Roughens the particles of a Rao-Blackwellized state, such as a ParticleGaussianParams, by their own bandwidth.
Their Gaussians are left as they were, as if each particle had always been where it is moved to: an approximation, as roughening always is. It roughens a copy of the particle set and writes the states back, so it allocates the copy at each call.
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |