EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Fitting.h File Reference

Fitting a Gaussian mixture by expectation-maximization: fitMixture() over particles, over a mixture's components (hierarchical EM, a mixture reduction), or over particles seeded from a mixture, with FitOptions and the MixtureFit result. More...

#include <algorithm>
#include <array>
#include <cstddef>
#include <expected>
#include <random>
#include <span>
#include <utility>
#include <vector>
#include <Eigen/Cholesky>
#include <EmrysFilter/Core/Execution.h>
#include <EmrysFilter/Distributions/Mixture.h>
#include <EmrysFilter/Core/Macros.h>
#include <EmrysFilter/Core/Math.h>
#include <EmrysFilter/Distributions/Moments.h>
#include <EmrysFilter/Distributions/ParticleSet.h>
#include <EmrysFilter/Core/Resampling.h>
#include <EmrysFilter/Distributions/SampleSet.h>
#include <EmrysFilter/Spaces/Space.h>
#include <EmrysFilter/Distributions/Statistics.h>
#include <EmrysFilter/Core/Solve.h>
#include <EmrysFilter/Core/Weights.h>
#include <EmrysFilter/Core/Print.h>

Go to the source code of this file.

Classes

struct  Emrys::FitOptions< Scalar >
 Options for fitMixture(). More...
struct  Emrys::MixtureFit< Space, Scalar, Allocator >
 Result of fitMixture(), in Space, with the source's allocator. More...

Enumerations

enum class  Emrys::FitError { FitError::Degenerate , FitError::InvalidWeights }
 Reasons fitMixture() can fail. More...

Functions

template<typename Scalar, typename Space, typename Allocator, std::uniform_random_bit_generator G>
std::expected< MixtureFit< Space, Scalar, Allocator >, FitError > Emrys::fitMixture (ParticleSet< Space, Scalar, Allocator > const &particles, Eigen::Index k, G &rng, FitOptions< Scalar > const &options={})
template<typename Scalar, typename Space, typename Allocator, std::uniform_random_bit_generator G>
std::expected< MixtureFit< Space, Scalar, Allocator >, FitError > Emrys::fitMixture (GaussianMixture< Space, Scalar, Allocator > const &mixture, Eigen::Index k, G &rng, FitOptions< Scalar > const &options={})
template<typename Scalar, typename Space, typename Allocator, typename SeedAllocator, std::uniform_random_bit_generator G>
std::expected< MixtureFit< Space, Scalar, Allocator >, FitError > Emrys::fitMixture (ParticleSet< Space, Scalar, Allocator > const &particles, GaussianMixture< Space, Scalar, SeedAllocator > const &seedsFrom, Eigen::Index k, G &rng, FitOptions< Scalar > const &options={})
template<ExecutionPolicy P, typename Scalar, typename Space, typename Allocator, std::uniform_random_bit_generator G>
std::expected< MixtureFit< Space, Scalar, Allocator >, FitError > Emrys::fitMixture (P &&policy, ParticleSet< Space, Scalar, Allocator > const &particles, Eigen::Index k, G &rng, FitOptions< Scalar > const &options={})
 fitMixture() of particles under policy: each E-step is a for-each over the particles, and each M-step's moments are reductions over them, which match Sequential's to rounding (see Execution policies).
template<ExecutionPolicy P, typename Scalar, typename Space, typename Allocator, std::uniform_random_bit_generator G>
std::expected< MixtureFit< Space, Scalar, Allocator >, FitError > Emrys::fitMixture (P &&policy, GaussianMixture< Space, Scalar, Allocator > const &mixture, Eigen::Index k, G &rng, FitOptions< Scalar > const &options={})
 fitMixture() of mixture under policy, a for-each and reductions over its components as fitMixture(P &&, ParticleSet const &, Eigen::Index, G &, FitOptions const &) runs over particles.
template<ExecutionPolicy P, typename Scalar, typename Space, typename Allocator, typename SeedAllocator, std::uniform_random_bit_generator G>
std::expected< MixtureFit< Space, Scalar, Allocator >, FitError > Emrys::fitMixture (P &&policy, ParticleSet< Space, Scalar, Allocator > const &particles, GaussianMixture< Space, Scalar, SeedAllocator > const &seedsFrom, Eigen::Index k, G &rng, FitOptions< Scalar > const &options={})
 fitMixture() of particles seeded from seedsFrom, under policy, as fitMixture(P &&, ParticleSet const &, Eigen::Index, G &, FitOptions const &) runs.

Detailed Description

Fitting a Gaussian mixture by expectation-maximization: fitMixture() over particles, over a mixture's components (hierarchical EM, a mixture reduction), or over particles seeded from a mixture, with FitOptions and the MixtureFit result.

Read Upkeep.h next.