EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Emrys::upkeep::FloorModes< Scalar_ > Struct Template Reference

Action that raises every mode less probable than probability to it, scaling the others down to keep the sum one, so that no mode is ruled out for good. More...

#include <EmrysFilter/Distributions/Upkeep.h>

Public Member Functions

template<typename State>
requires requires(State & state) { state.modes().logTotalWeight(); state.modes().logWeights(); state.setModes(state.modes()); }
std::expected< bool, WeightError > operator() (State &state) const
 Floors state's mode probabilities, read by modes() and written by setModes().
template<typename Space, typename Scalar>
std::expected< bool, WeightError > operator() (CategoricalParams< Space, Scalar > &categorical) const
 Floors the probabilities of categorical, the state of a HiddenMarkovFilter, as those of a hybrid's modes.
template<typename Component, typename Allocator>
requires requires(typename MixtureParams<Component, Allocator>::ComponentType & hybrid) { hybrid.setModes(hybrid.modes()); }
std::expected< bool, WeightError > operator() (MixtureParams< Component, Allocator > &mixture) const
 Floors the mode probabilities of each component of mixture, a mixture of hybrids, and leaves the components' weights as they are.

Public Attributes

Scalar_ probability
 no mode is left less probable than this

Detailed Description

template<RealScalar Scalar_ = double>
struct Emrys::upkeep::FloorModes< Scalar_ >

Action that raises every mode less probable than probability to it, scaling the others down to keep the sum one, so that no mode is ruled out for good.

The state is anything with modes() and setModes(), such as the Hybrid of an ImmFilter; a CategoricalParams, the state of a HiddenMarkovFilter, whose values it floors as modes; or a MixtureParams of hybrids, each of whose components it floors in turn.

Under Bayes' rule a mode whose probability is zero can never come back, and one that is merely tiny takes as much evidence to come back as it took to fall. An AmmFilter, whose chain moves no probability between modes, then cannot follow a change of mode; applied after each update, the floor keeps every mode within reach of the next few measurements. probability times the number of modes must not exceed one.

The lower bound on the model probabilities of Athans et al. (1977), §V-F, set there so that the identification stays "sensitive to such changes". The paper does not say how the probabilities are brought back to a sum of one. Here the modes above the floor share what the floored ones leave in proportion to their probabilities, and a mode that sharing takes below the floor is floored too, so every mode ends at least at the floor and the ratios among the modes it doesn't floor are unchanged. Unlike the other actions it changes the distribution on purpose, by at most probability times the number of modes in total variation, which is why it is upkeep the caller places rather than an option of the filter (decisions.md [autonomous-multiple-model]).

Scalar_ is the type of probability, deduced from the one given (upkeep::floorModes(1e-3f) holds a float).

See also
AmmFilter, HiddenMarkovFilter

Member Function Documentation

◆ operator()() [1/3]

template<RealScalar Scalar_ = double>
template<typename Space, typename Scalar>
std::expected< bool, WeightError > Emrys::upkeep::FloorModes< Scalar_ >::operator() ( CategoricalParams< Space, Scalar > & categorical) const
inlinenodiscard

Floors the probabilities of categorical, the state of a HiddenMarkovFilter, as those of a hybrid's modes.

Returns
whether any value was raised, or the WeightError of weights that fail to define a distribution, which are left as they are

◆ operator()() [2/3]

template<RealScalar Scalar_ = double>
template<typename Component, typename Allocator>
requires requires(typename MixtureParams<Component, Allocator>::ComponentType & hybrid) { hybrid.setModes(hybrid.modes()); }
std::expected< bool, WeightError > Emrys::upkeep::FloorModes< Scalar_ >::operator() ( MixtureParams< Component, Allocator > & mixture) const
inlinenodiscard

Floors the mode probabilities of each component of mixture, a mixture of hybrids, and leaves the components' weights as they are.

Returns
whether any component's mode was raised, or the WeightError of the first component whose mode weights fail to define a distribution, with no component changed

◆ operator()() [3/3]

template<RealScalar Scalar_ = double>
template<typename State>
requires requires(State & state) { state.modes().logTotalWeight(); state.modes().logWeights(); state.setModes(state.modes()); }
std::expected< bool, WeightError > Emrys::upkeep::FloorModes< Scalar_ >::operator() ( State & state) const
inlinenodiscard

Floors state's mode probabilities, read by modes() and written by setModes().

Returns
whether any mode was raised, or the WeightError of mode weights that fail to define a distribution, which are left as they are

The documentation for this struct was generated from the following file: