Doxygen 1.9.1
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.1
TasDREAM::LikelihoodGaussIsotropic Class Reference

Implements likelihood under the assumption of isotropic white noise. More...

#include <tsgDreamLikelyGaussian.hpp>

Inheritance diagram for TasDREAM::LikelihoodGaussIsotropic:
Collaboration diagram for TasDREAM::LikelihoodGaussIsotropic:

Public Member Functions

 LikelihoodGaussIsotropic ()
 Default constructor for convenience, an object constructed with the default cannot be used until setData() is called.
 
 LikelihoodGaussIsotropic (double variance, const std::vector< double > &data_mean, size_t num_observe=1)
 Constructs the class and calls setData().
 
 ~LikelihoodGaussIsotropic ()=default
 Default destructor.
 
void setData (double variance, const std::vector< double > &data_mean, size_t num_observe=1)
 Set the noise magnitude (varaince) the observed data (data_mean) and number of observations (num_observe). More...
 
void getLikelihood (TypeSamplingForm form, const std::vector< double > &model, std::vector< double > &likely) const override final
 Compute the likelihood of a set of model outputs.
 
void getLikelihood (TypeSamplingForm form, double const model[], int num_samples, double likely[]) const override final
 Overload for raw-arrays, for interface purposes mostly, e.g., python.
 
int getNumOutputs () const override
 Returns the size of the data_mean vector (for error checking purposes).
 
void write (std::ostream &os, int outputs_begin=0, int outputs_end=-1) const
 Writes the data for a portion of the outputs into a stream. More...
 
void read (std::istream &is)
 Reads the data from a stream, assumes write() has been used first.
 
- Public Member Functions inherited from TasDREAM::TasmanianLikelihood
 TasmanianLikelihood ()
 Empty default constructor.
 
virtual ~TasmanianLikelihood ()
 Empty virtual destructor.
 
virtual operator std::function< void (TypeSamplingForm, const std::vector< double > &, std::vector< double > &)>() const
 Automatically convert the likelihood into input for TasDREAM::posterior().
 

Detailed Description

Implements likelihood under the assumption of isotropic white noise.

Gaussian Likelihood
The general formula for Gaussian likelihood is $ L(y | d_1 \cdots d_n) = \exp\left( 0.5 sum_{i=1}^n (y - d_i)^T \Sigma^{-1} (y - d_i) \right)$ where the $ d_i $ are the data observations, y is the model output, and $ \Sigma $ is the noise covariance matrix.
Isotropic Gaussian
The simplest isotopic case of Gaussian likelihood assumes that the covariance matrix is scaled identity, i.e., the noise has no correlation and has the same magnitude for each model output, then inverting the covariance matrix reduces to multiplying by the inverse of the noise variance (magnitude). Also, the sum corresponding to the multiple data samples can be replaced by scaled operation on the data mean (average).

Member Function Documentation

◆ setData()

void TasDREAM::LikelihoodGaussIsotropic::setData ( double  variance,
const std::vector< double > &  data_mean,
size_t  num_observe = 1 
)

Set the noise magnitude (varaince) the observed data (data_mean) and number of observations (num_observe).

Set the parameters of the likelihood.

Parameters
variancemust be a positive number indicating the magnitude of the noise.
data_meanmust have the same size as the number of model outputs and hold the average of all measurements.
num_observemust be a positive integer indicating the number of samples.

◆ write()

void TasDREAM::LikelihoodGaussIsotropic::write ( std::ostream &  os,
int  outputs_begin = 0,
int  outputs_end = -1 
) const
inline

Writes the data for a portion of the outputs into a stream.

The likelihood object does not store the raw inputs to setData(), instead optimized data-structures are used. This method writes either entire likelihood or the optimized data for a portion of the outputs.

Parameters
osis the stream where the data will be written.
outputs_beginis the first output to include in the write process.
outputs_endis one more than the last output to write, use -1 to indicate all outputs after output_begin.

This method is used by the MPI scatter likelihood template.


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