Template Class CRejectionSamplingCapable
Defined in File CRejectionSamplingCapable.h
Class Documentation
-
template<class TStateSpace, mrpt::bayes::particle_storage_mode STORAGE = mrpt::bayes::particle_storage_mode::POINTER>
class CRejectionSamplingCapable A base class for implementing rejection sampling in a generic state space. See the main method CRejectionSamplingCapable::rejectionSampling To use this class, create your own class as a child of this one and implement the desired virtual methods, and add any required internal data.
Public Types
-
using TParticle = CProbabilityParticle<TStateSpace, STORAGE>
Public Functions
-
virtual ~CRejectionSamplingCapable() = default
Virtual destructor
-
inline std::vector<TParticle> rejectionSampling(size_t desiredSamples, size_t timeoutTrials = 1000)
Generates a set of N independent samples via rejection sampling.
- Parameters:
desiredSamples – The number of desired samples to generate.
timeoutTrials – The maximum number of rejection trials per sample. Samples that exceed the timeout are assigned a weight proportional to the best likelihood seen, rather than the uniform weight of accepted samples.
- Returns:
Vector of desiredSamples particles.
Protected Functions
-
virtual void RS_drawFromProposal(TStateSpace &outSample) = 0
Generates one sample, drawing from some proposal distribution.
-
virtual double RS_observationLikelihood(const TStateSpace &x) = 0
Returns the NORMALIZED observation likelihood (linear, not exponential!!!) at a given point of the state space (values in the range [0,1]).
-
using TParticle = CProbabilityParticle<TStateSpace, STORAGE>