EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Emrys::EmissionTable< Space_, ObservationSpace_, Scalar_ > Class Template Reference

An emission table: the probability of each observed value given each value of the state. More...

#include <EmrysFilter/Models/Emission.h>

Classes

class  Observation
 The emission model of one observed value: the column of the table it selects. More...

Public Types

using Scalar = Scalar_
 the scalar type of the probabilities
using SpaceType = Space_
 the discrete space of the state
using ObservationSpaceType = ObservationSpace_
 the discrete space of the observation
using MatrixType
 The emission matrix's type: a row per value of the state, a column per observed value.

Public Member Functions

template<MatrixExpression Matrix>
 EmissionTable (Space_ space, ObservationSpace_ observations, Matrix &&matrix)
 The table over space and observations with emission matrix matrix: nonnegative, with each row summing to one.
Space_ const & space () const
ObservationSpace_ const & observationSpace () const
MatrixType const & matrix () const
Observation observe (Eigen::Index observed) const &
void observe (Eigen::Index observed) const &&=delete
 observe() of a temporary table is deleted: the observation refers to the table, which would be gone at the end of the full expression (hidden-markov-filter.md Q4).

Detailed Description

template<DiscreteSpace Space_, DiscreteSpace ObservationSpace_, RealScalar Scalar_ = double>
class Emrys::EmissionTable< Space_, ObservationSpace_, Scalar_ >

An emission table: the probability of each observed value given each value of the state.

The emission matrix \( B \) of a hidden Markov model with a finite observation space (Rabiner (1989), §II), a right stochastic matrix with a row per value of the state and a column per observed value, \( B_{vz} = P(z \mid v) \). The table itself is not an emission model: observe() names what was observed and borrows the table, so a filter updated every step doesn't copy the matrix.

auto const table =
EmissionTable{Weather{}, Activity{}, Eigen::Matrix<double, 2, 3>{{0.1, 0.4, 0.5}, {0.6, 0.3, 0.1}}};
auto const evidence = update(prior, table.observe(Activity::index<Walk>()));
EmissionTable(Space_ space, ObservationSpace_ observations, Matrix &&matrix)
The table over space and observations with emission matrix matrix: nonnegative, with each row summing...
Definition Emission.h:193
std::expected< CategoricalUpdate< Space, Scalar >, WeightError > update(CategoricalParams< Space, Scalar > const &prior, E const &emission)
Definition Emission.h:97
Template Parameters
Space_the discrete space of the state
ObservationSpace_the discrete space of the observation
Scalar_scalar type of the probabilities, double by default

Member Typedef Documentation

◆ MatrixType

template<DiscreteSpace Space_, DiscreteSpace ObservationSpace_, RealScalar Scalar_ = double>
using Emrys::EmissionTable< Space_, ObservationSpace_, Scalar_ >::MatrixType
Initial value:
Eigen::Matrix<
Scalar_,
Space_::Cardinality,
ObservationSpace_::Cardinality,
Eigen::RowMajor,
Space_::MaxCardinality,
ObservationSpace_::MaxCardinality>

The emission matrix's type: a row per value of the state, a column per observed value.

Member Function Documentation

◆ matrix()

template<DiscreteSpace Space_, DiscreteSpace ObservationSpace_, RealScalar Scalar_ = double>
MatrixType const & Emrys::EmissionTable< Space_, ObservationSpace_, Scalar_ >::matrix ( ) const
inlinenodiscard
Returns
the emission matrix \( B \), with \( B_{vz} = P(z \mid v) \)

◆ observationSpace()

template<DiscreteSpace Space_, DiscreteSpace ObservationSpace_, RealScalar Scalar_ = double>
ObservationSpace_ const & Emrys::EmissionTable< Space_, ObservationSpace_, Scalar_ >::observationSpace ( ) const
inlinenodiscard
Returns
the discrete space of the observation

◆ observe()

template<DiscreteSpace Space_, DiscreteSpace ObservationSpace_, RealScalar Scalar_ = double>
Observation Emrys::EmissionTable< Space_, ObservationSpace_, Scalar_ >::observe ( Eigen::Index observed) const &
inlinenodiscard
Returns
the emission model of observing the value with flat index observed

◆ space()

template<DiscreteSpace Space_, DiscreteSpace ObservationSpace_, RealScalar Scalar_ = double>
Space_ const & Emrys::EmissionTable< Space_, ObservationSpace_, Scalar_ >::space ( ) const
inlinenodiscard
Returns
the discrete space of the state

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