https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
TruncatedGaussian Class Reference

A class used to generate a truncated Gaussian likelihood of observing model predictions. More...

#include <TruncatedGaussian.h>

Inheritance diagram for TruncatedGaussian:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 TruncatedGaussian (const InputParameters &parameters)
 
virtual Real function (const std::vector< Real > &x) const override
 Return the probability density or mass function at vector x. More...
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static Real function (const std::vector< Real > &exp, const std::vector< Real > &model, const Real &noise, const Real &lower_bound, const Real &upper_bound, const bool &log_likelihood)
 Return the probability density function. More...
 
static Real function (const std::vector< Real > &exp, const std::vector< Real > &model, const Real &noise, const bool &log_likelihood)
 Return the probability density function. More...
 

Public Attributes

const ConsoleStream _console
 

Protected Member Functions

const ReporterNamegetReporterName (const std::string &param_name) const
 
virtual void addReporterDependencyHelper (const ReporterName &)
 
const T & getReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 

Protected Attributes

const bool _log_likelihood
 return log-likelihood or likelihood More...
 
const Real_noise
 Noise value. More...
 
std::vector< Real_exp_values
 Experimental data values. More...
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
const Parallel::Communicator & _communicator
 

Private Attributes

const Real _lower_bound
 Lower bound. More...
 
const Real _upper_bound
 Upper bound. More...
 

Detailed Description

A class used to generate a truncated Gaussian likelihood of observing model predictions.

Definition at line 17 of file TruncatedGaussian.h.

Constructor & Destructor Documentation

◆ TruncatedGaussian()

TruncatedGaussian::TruncatedGaussian ( const InputParameters parameters)

Definition at line 26 of file TruncatedGaussian.C.

28  _lower_bound(getParam<Real>("lower_bound")),
29  _upper_bound(getParam<Real>("upper_bound"))
30 {
31  if (!(_lower_bound < _upper_bound))
32  mooseError("The specified lower bound should be less than the upper bound.");
33 }
const Real _lower_bound
Lower bound.
Gaussian(const InputParameters &parameters)
Definition: Gaussian.C:33
const Real _upper_bound
Upper bound.
void mooseError(Args &&... args) const
const InputParameters & parameters() const

Member Function Documentation

◆ function() [1/3]

Real TruncatedGaussian::function ( const std::vector< Real > &  x) const
overridevirtual

Return the probability density or mass function at vector x.

Parameters
xThe input vector x

Reimplemented from Gaussian.

Definition at line 52 of file TruncatedGaussian.C.

53 {
55 }
const Real _lower_bound
Lower bound.
const Real & _noise
Noise value.
Definition: Gaussian.h:44
const Real _upper_bound
Upper bound.
const std::vector< double > x
const bool _log_likelihood
return log-likelihood or likelihood
Definition: Gaussian.h:41
std::vector< Real > _exp_values
Experimental data values.
Definition: Gaussian.h:47

◆ function() [2/3]

Real Gaussian::function ( const std::vector< Real > &  exp,
const std::vector< Real > &  model,
const Real noise,
const bool &  log_likelihood 
)
staticinherited

Return the probability density function.

Parameters
expThe experimental measurement
modelThe model prediction
noiseThe standard deviation
log_likelihoodBool to return the log likelihood value

Definition at line 58 of file Gaussian.C.

62 {
63  Real result = 0.0;
64  Real val1;
65  for (unsigned i = 0; i < exp.size(); ++i)
66  {
67  val1 = Normal::pdf(exp[i], model[i], noise);
68  val1 = std::log(val1);
69  result += val1;
70  }
71  if (!log_likelihood)
72  result = std::exp(result);
73  return result;
74 }
auto exp(const T &)
virtual Real pdf(const Real &x) const override
Definition: Normal.C:68
const PertinentGeochemicalSystem model(database, {"H2O", "H+", "HCO3-", "O2(aq)", "Ca++", ">(s)FeOH", "radius_neg1", "radius_neg1.5"}, {"Calcite"}, {}, {"Calcite_asdf"}, {"CH4(aq)"}, {">(s)FeOCa+"}, "O2(aq)", "e-")
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ function() [3/3]

Real TruncatedGaussian::function ( const std::vector< Real > &  exp,
const std::vector< Real > &  model,
const Real noise,
const Real lower_bound,
const Real upper_bound,
const bool &  log_likelihood 
)
static

Return the probability density function.

Parameters
expThe experimental measurement
modelThe model prediction
noiseThe standard deviation
lower_boundThe lower bound
upper_boundThe upper bound
log_likelihoodBool to return the log likelihood value

Definition at line 36 of file TruncatedGaussian.C.

42 {
43  Real result = 0.0;
44  for (unsigned i = 0; i < exp.size(); ++i)
45  result += std::log(TruncatedNormal::pdf(exp[i], model[i], noise, lower_bound, upper_bound));
46  if (!log_likelihood)
47  result = std::exp(result);
48  return result;
49 }
auto exp(const T &)
virtual Real pdf(const Real &x) const override
const PertinentGeochemicalSystem model(database, {"H2O", "H+", "HCO3-", "O2(aq)", "Ca++", ">(s)FeOH", "radius_neg1", "radius_neg1.5"}, {"Calcite"}, {}, {"Calcite_asdf"}, {"CH4(aq)"}, {">(s)FeOCa+"}, "O2(aq)", "e-")
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ validParams()

InputParameters TruncatedGaussian::validParams ( )
static

Definition at line 16 of file TruncatedGaussian.C.

17 {
19  params.addClassDescription(
20  "TruncatedGaussian likelihood function evaluating the model goodness against experiments.");
21  params.addRequiredParam<Real>("lower_bound", "Lower bound for the quantity of interest.");
22  params.addRequiredParam<Real>("upper_bound", "Upper bound for the quantity of interest.");
23  return params;
24 }
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
Definition: Gaussian.C:17
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _exp_values

std::vector<Real> Gaussian::_exp_values
protectedinherited

Experimental data values.

Definition at line 47 of file Gaussian.h.

Referenced by ExtremeValue::function(), function(), Gaussian::function(), and Gaussian::Gaussian().

◆ _log_likelihood

const bool Gaussian::_log_likelihood
protectedinherited

return log-likelihood or likelihood

Definition at line 41 of file Gaussian.h.

Referenced by ExtremeValue::function(), function(), and Gaussian::function().

◆ _lower_bound

const Real TruncatedGaussian::_lower_bound
private

Lower bound.

Definition at line 44 of file TruncatedGaussian.h.

Referenced by function(), and TruncatedGaussian().

◆ _noise

const Real& Gaussian::_noise
protectedinherited

Noise value.

Definition at line 44 of file Gaussian.h.

Referenced by ExtremeValue::function(), function(), and Gaussian::function().

◆ _upper_bound

const Real TruncatedGaussian::_upper_bound
private

Upper bound.

Definition at line 47 of file TruncatedGaussian.h.

Referenced by function(), and TruncatedGaussian().


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