ReFRACtor
FullPhysics::MaxLikelihood Class Referenceabstract

The base class for maximum likelihood estimation. More...

#include <max_likelihood.h>

+ Inheritance diagram for FullPhysics::MaxLikelihood:
+ Collaboration diagram for FullPhysics::MaxLikelihood:

Public Member Functions

 MaxLikelihood ()
 Default Constructor. More...
 
virtual ~MaxLikelihood ()
 
virtual void assert_jacobian_correct (const blitz::Array< double, 2 > &k) const
 Conditions that must be satisfied when a derived class computes the Jacobian of the model. More...
 
virtual void assert_model_correct (const blitz::Array< double, 1 > &m) const
 Conditions that must be satisfied when a derived class computes the model. More...
 
virtual void assert_parameter_correct (const blitz::Array< double, 1 > &x) const
 Checks that the new input parameters are correct. More...
 
virtual void assert_parameter_set_correctly () const
 Checks that the parameters are set correctly. More...
 
virtual void clear ()
 Deletes data contents. More...
 
virtual int expected_parameter_size () const
 Returns the expected size of the parameters. More...
 
bool jacobean_computed () const
 A boolean function to check whether or not the Jacobean of the model is computed. More...
 
virtual blitz::Array< double, 2 > jacobian ()
 Evaluates and returns the Jacobian of the model at the currently set parameter values. More...
 
virtual void jacobian_eval ()=0
 Evaluates the Jacobian of the model at the currently set parameter values. More...
 
virtual blitz::Array< double, 2 > jacobian_x (const blitz::Array< double, 1 > &x)
 The model Jacobian with parameters. More...
 
virtual blitz::Array< double, 1 > measurement () const
 Returns the measured data, to which the model is fit. More...
 
virtual blitz::Array< double, 1 > measurement_error_cov () const
 Returns the measurement error covariance (implemented as a diagonal matrix). More...
 
virtual int measurement_size () const
 Returns the size of the measurement data vector. More...
 
virtual blitz::Array< double, 1 > model ()
 Evaluates and returns the model at the currently set parameter values. More...
 
bool model_computed () const
 A boolean function to check whether or not the model is computed. More...
 
virtual void model_eval ()=0
 Evaluates the model at the currently set parameter values. More...
 
virtual void model_jacobian (blitz::Array< double, 1 > &m, blitz::Array< double, 2 > &k)
 Evaluates model and its Jacobian together. More...
 
virtual void model_jacobian_eval ()
 Evaluates the model and its Jacobian at the currently set parameter values. More...
 
virtual void model_jacobian_x (const blitz::Array< double, 1 > &x, blitz::Array< double, 1 > &m, blitz::Array< double, 2 > &k)
 Model and its Jacobian with parameters. More...
 
virtual blitz::Array< double, 1 > model_measure_diff ()
 Returns model and measurement difference (model - measurement) More...
 
virtual blitz::Array< double, 1 > model_x (const blitz::Array< double, 1 > &x)
 The model function with parameters. More...
 
virtual int parameter_size () const
 Returns the size of the parameters. More...
 
virtual void parameters (const blitz::Array< double, 1 > &x)
 Sets the problem at a new point in the parameter space. More...
 
virtual blitz::Array< double, 1 > parameters () const
 Returns the current parameters. More...
 
virtual bool parameters_different (const blitz::Array< double, 1 > &x) const
 Checks whether or not new input parameters are different from the current ones. More...
 
virtual void print (std::ostream &Os) const
 Prints description of object. More...
 
std::string print_to_string () const
 Print to string. More...
 
virtual void set (const ModelState &s)
 Makes self a copy of the input state. More...
 
virtual void set (const ProblemState &s)
 Makes self a copy of the input state. More...
 
void set_measurement (const blitz::Array< double, 1 > &measurement, const blitz::Array< double, 1 > &measurement_error_cov)
 For setting measurement and the error covariance matrix. More...
 
virtual blitz::Array< double, 2 > uncert_weighted_jac_inner_product ()
 Returns the inner product of the matrix returned by the method uncert_weighted_jacobian() by itself. More...
 
virtual blitz::Array< double, 2 > uncert_weighted_jacobian ()
 Returns the model Jacobian weighted by the inverse of the Cholesky decomposition of the error covariance matrix. More...
 
virtual blitz::Array< double, 1 > uncert_weighted_model_measure_diff ()
 Returns model and measurement difference weighted by the inverse of the Cholesky decomposition of the error covariance matrix. More...
 

Protected Attributes

blitz::Array< double, 2 > K
 
blitz::Array< double, 1 > M
 
blitz::Array< double, 1 > msrmnt
 
blitz::Array< double, 1 > Se
 
blitz::Array< double, 1 > Se_chol
 
blitz::Array< double, 1 > X
 

Detailed Description

The base class for maximum likelihood estimation.

This class is the base class for all classes that use maximum likelihood estimation method to implement the problem of estimating the parameters of a statistical model.

Definition at line 16 of file max_likelihood.h.

Constructor & Destructor Documentation

◆ MaxLikelihood()

FullPhysics::MaxLikelihood::MaxLikelihood ( )
inline

Default Constructor.

Definition at line 26 of file max_likelihood.h.

◆ ~MaxLikelihood()

virtual FullPhysics::MaxLikelihood::~MaxLikelihood ( )
inlinevirtual

Definition at line 29 of file max_likelihood.h.

Member Function Documentation

◆ assert_jacobian_correct()

void ModelMeasure::assert_jacobian_correct ( const blitz::Array< double, 2 > &  k) const
virtualinherited

Conditions that must be satisfied when a derived class computes the Jacobian of the model.

This method is just the implementation of some conditions that must be satisfied after a derived class computes the Jacobian of the model. The derived class itself calls this method to check the computed Jacobian.

Parameters
[in]kThe computed model

Definition at line 35 of file model_measure.cc.

◆ assert_model_correct()

void ModelMeasure::assert_model_correct ( const blitz::Array< double, 1 > &  m) const
virtualinherited

Conditions that must be satisfied when a derived class computes the model.

This method is just the implementation of some conditions that must be satisfied after a derived class computes the model. The derived class itself calls this method to check the computed model.

Parameters
[in]mThe computed model

Definition at line 28 of file model_measure.cc.

◆ assert_parameter_correct()

void ProblemState::assert_parameter_correct ( const blitz::Array< double, 1 > &  x) const
virtualinherited

Checks that the new input parameters are correct.

This method checks to see whether or not the new input parameters are correct. If the parameters are not correct then it throws an exception.

Definition at line 44 of file problem_state.cc.

◆ assert_parameter_set_correctly()

virtual void FullPhysics::ProblemState::assert_parameter_set_correctly ( ) const
inlinevirtualinherited

Checks that the parameters are set correctly.

This method checks to see whether or not the parameters are set correctly. If the parameters are not set correctly then it throws an exception.

Definition at line 197 of file problem_state.h.

◆ clear()

virtual void FullPhysics::ModelState::clear ( )
inlinevirtualinherited

Deletes data contents.

This method deletes state. If needed, it must be reimplemented by other classes derived from this class to delete other saved components associated with the state as well.

Reimplemented from FullPhysics::ProblemState.

Definition at line 84 of file model_state.h.

◆ expected_parameter_size()

virtual int FullPhysics::ProblemState::expected_parameter_size ( ) const
inlinevirtualinherited

Returns the expected size of the parameters.

This method must be reimplemented by the problem class the inherits ProblemState. It is only in the context of an optimization problem that one knows what the size of the parameters (number of the dimensions of the parameter space) is.

This method is intentionally implemented here instead of being left as a pure virtual method. The intention is that the user to be able to create an object of this class or its derived classes for the purpose of preserving an older state of a problem if needed.

Returns
Expected size of parameters

Reimplemented in FullPhysics::NLLSMaxAPosteriori, FullPhysics::NLLSMaxLikelihood, FullPhysics::NLLSProblemScaled, FullPhysics::ModelMeasureStandard, FullPhysics::ModelMeasureBard, FullPhysics::ModelMeasureMeyer, FullPhysics::FmNLLSProblem, FullPhysics::BardNLLSProblem, FullPhysics::BrownNLLSProblem, FullPhysics::FreudensteinRothNLLSProblem, FullPhysics::HelicalValleyNLLSProblem, FullPhysics::JennrichSampsonNLLSProblem, FullPhysics::MeyerNLLSProblem, FullPhysics::PowellNLLSProblem, FullPhysics::PowellSingularNLLSProblem, and FullPhysics::Rosenbrock2NLLSProblem.

Definition at line 185 of file problem_state.h.

◆ jacobean_computed()

bool FullPhysics::ModelMeasure::jacobean_computed ( ) const
inlineinherited

A boolean function to check whether or not the Jacobean of the model is computed.

Returns
true if Jacobean is computed false otherwise

Definition at line 367 of file model_measure.h.

◆ jacobian()

virtual blitz::Array<double, 2> FullPhysics::ModelMeasure::jacobian ( )
inlinevirtualinherited

Evaluates and returns the Jacobian of the model at the currently set parameter values.

All the comments on jacobian_eval() method also apply to this method, and in addition this method returns the evaluated Jacobian.

The sizes of the Jacobian matrix can be obtained in advance:

Returns
Evaluated model Jacobian at the current point

Definition at line 190 of file model_measure.h.

◆ jacobian_eval()

virtual void FullPhysics::ModelMeasure::jacobian_eval ( )
pure virtualinherited

Evaluates the Jacobian of the model at the currently set parameter values.

This method must be implemented by the classes derived from this class.

The parameters (the point in the parameter space) must have already been set before calling this method. The parameters are already set if one of the following methods is already called successfully:

If the parameters are already set, then this method evaluate the Jacobian of the model at the currently set parameter values (point in the parameter space).

Implemented in FullPhysics::ModelMeasureStandard, FullPhysics::ModelMeasureBard, and FullPhysics::ModelMeasureMeyer.

◆ jacobian_x()

virtual blitz::Array<double, 2> FullPhysics::ModelMeasure::jacobian_x ( const blitz::Array< double, 1 > &  x)
inlinevirtualinherited

The model Jacobian with parameters.

This method also evaluates the Jacobian; however, it sets the model at the input new point and then evaluates its Jacobian.

The sizes of the Jacobian matrix can be obtained in advance:

Parameters
[in]xNew set of parameters
Returns
Evaluated model Jacobian at the input new point

Definition at line 211 of file model_measure.h.

◆ measurement()

virtual blitz::Array<double, 1> FullPhysics::ModelMeasure::measurement ( ) const
inlinevirtualinherited

Returns the measured data, to which the model is fit.

Returns
The measurement vector.

Definition at line 283 of file model_measure.h.

◆ measurement_error_cov()

virtual blitz::Array<double, 1> FullPhysics::ModelMeasure::measurement_error_cov ( ) const
inlinevirtualinherited

Returns the measurement error covariance (implemented as a diagonal matrix).

Returns
The measurement error covariance.

Definition at line 294 of file model_measure.h.

◆ measurement_size()

virtual int FullPhysics::ModelMeasure::measurement_size ( ) const
inlinevirtualinherited

Returns the size of the measurement data vector.

This method returns the size of the measured data vector. The following must also be equal to the value returned by measurement_size():

  • The size of the model data
  • The number of the rows of the model Jacobian
  • The number of the diagonal elements of the error covariance matrix
Returns
The size of the measurement data vector

Definition at line 312 of file model_measure.h.

◆ model()

virtual blitz::Array<double, 1> FullPhysics::ModelMeasure::model ( )
inlinevirtualinherited

Evaluates and returns the model at the currently set parameter values.

All the comments on model_eval() method also apply to this method, and in addition this method returns the evaluated model.

The size of the model vector can be obtained in advance by calling measurement_size().

Returns
Evaluated model at the current point

Definition at line 128 of file model_measure.h.

◆ model_computed()

bool FullPhysics::ModelMeasure::model_computed ( ) const
inlineinherited

A boolean function to check whether or not the model is computed.

Returns
true if model is computed false otherwise

Definition at line 356 of file model_measure.h.

◆ model_eval()

virtual void FullPhysics::ModelMeasure::model_eval ( )
pure virtualinherited

Evaluates the model at the currently set parameter values.

This method must be implemented by the classes derived from this class.

The parameters (the point in the parameter space) must have already been set before calling this method. The parameters are already set if one of the following methods is already called successfully:

If the parameters are already set, then this method evaluate the model at the currently set parameter values (point in the parameter space).

Implemented in FullPhysics::ModelMeasureStandard, FullPhysics::ModelMeasureBard, and FullPhysics::ModelMeasureMeyer.

◆ model_jacobian()

virtual void FullPhysics::ModelMeasure::model_jacobian ( blitz::Array< double, 1 > &  m,
blitz::Array< double, 2 > &  k 
)
inlinevirtualinherited

Evaluates model and its Jacobian together.

All the comments on model_jacobian_eval() method also apply to this method, and in addition this method passes to the caller the evaluated model and its Jacobian.

Parameters
[out]mThe model
[out]kThe Jacobian of the model

Definition at line 251 of file model_measure.h.

◆ model_jacobian_eval()

virtual void FullPhysics::ModelMeasure::model_jacobian_eval ( )
inlinevirtualinherited

Evaluates the model and its Jacobian at the currently set parameter values.

The parameters (the point in the parameter space) must have already been set before calling this method. The parameters are already set if one of the following methods is already called successfully:

If the parameters are already set, then this method evaluate the model and its Jacobian at the currently set parameter values (point in the parameter space).

Reimplemented in FullPhysics::ModelMeasureStandard, FullPhysics::ModelMeasureBard, and FullPhysics::ModelMeasureMeyer.

Definition at line 233 of file model_measure.h.

◆ model_jacobian_x()

virtual void FullPhysics::ModelMeasure::model_jacobian_x ( const blitz::Array< double, 1 > &  x,
blitz::Array< double, 1 > &  m,
blitz::Array< double, 2 > &  k 
)
inlinevirtualinherited

Model and its Jacobian with parameters.

This method passes to the caller the evaluated model and its Jacobian after setting the problem at the input new point.

Parameters
[in]xNew set of parameters
[out]mThe model
[out]kThe Jacobian of the model

Definition at line 272 of file model_measure.h.

◆ model_measure_diff()

virtual blitz::Array<double, 1> FullPhysics::ModelMeasure::model_measure_diff ( )
inlinevirtualinherited

Returns model and measurement difference (model - measurement)

This method is for convenience. It returns the difference of the computed model and the measurement. The difference is not called residual on purpose. The term residual will be used in the context of the Non-Linear (or Linear) Least Squares optimization.

Let the following be the computed model and the measured data respectively

  • M
  • S

Then this method returns

\[ M - S \]

Returns
Model and measurement difference (model - measurement)

Definition at line 410 of file model_measure.h.

◆ model_x()

virtual blitz::Array<double, 1> FullPhysics::ModelMeasure::model_x ( const blitz::Array< double, 1 > &  x)
inlinevirtualinherited

The model function with parameters.

This method also evaluates the model; however, it sets the model at the input new point and then evaluates the model.

The size of the model vector can be obtained in advance by calling measurement_size().

Parameters
[in]xNew set of parameters
Returns
Evaluated model at the input new point

Definition at line 147 of file model_measure.h.

◆ parameter_size()

virtual int FullPhysics::ProblemState::parameter_size ( ) const
inlinevirtualinherited

Returns the size of the parameters.

Returns
Size of parameters

Definition at line 163 of file problem_state.h.

◆ parameters() [1/2]

void ProblemState::parameters ( const blitz::Array< double, 1 > &  x)
virtualinherited

Sets the problem at a new point in the parameter space.

The method calls parameters_different() to determine whether or not the new parameters are different:

  • If different, then it deletes the object state (see clear()), and the input x becomes the current state.
  • If not different, then the input parameters are ignored.
Parameters
[in]xNew set of parameters

Reimplemented in FullPhysics::NLLSProblemScaled, FullPhysics::NLLSMaxAPosteriori, FullPhysics::NLLSMaxLikelihood, and FullPhysics::ModelMeasureStandard.

Definition at line 36 of file problem_state.cc.

◆ parameters() [2/2]

virtual blitz::Array<double, 1> FullPhysics::ProblemState::parameters ( ) const
inlinevirtualinherited

Returns the current parameters.

Returns
Current parameter

Reimplemented in FullPhysics::NLLSProblemScaled, FullPhysics::NLLSMaxAPosteriori, FullPhysics::NLLSMaxLikelihood, and FullPhysics::ModelMeasureStandard.

Definition at line 153 of file problem_state.h.

◆ parameters_different()

bool ProblemState::parameters_different ( const blitz::Array< double, 1 > &  x) const
virtualinherited

Checks whether or not new input parameters are different from the current ones.

The methods checks to see whether or not the new input parameters (point in the parameter space) are different from the parameters maintained by the object for which the method is called.

If the size of the input parameters is not equal to the expected size of the parameters (check comments on expected_parameter_size), then the method will throw an exception.

If the object for which the method is called has currently no parameters set, then the method returns true. Otherwise, the method uses some algorithm to figure out when the difference is "big enough" to be considered different. If the method determines that the new input parameters are different from the current parameters, then it returns true, otherwise, it returns false.

Parameters
[in]xNew set of parameters

Definition at line 9 of file problem_state.cc.

◆ print()

virtual void FullPhysics::MaxLikelihood::print ( std::ostream &  Os) const
inlinevirtual

Prints description of object.

Reimplemented from FullPhysics::ModelMeasure.

Reimplemented in FullPhysics::BardMLProblem, and FullPhysics::MeyerMLProblem.

Definition at line 36 of file max_likelihood.h.

◆ print_to_string()

std::string FullPhysics::Printable< ProblemState >::print_to_string ( ) const
inlineinherited

Print to string.

This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.

Definition at line 31 of file printable.h.

◆ set() [1/2]

void ModelState::set ( const ModelState s)
virtualinherited

Makes self a copy of the input state.

This method makes the object, for which it is called, a copy of the input state.

Parameters
[in]sanother ModelState

Definition at line 7 of file model_state.cc.

◆ set() [2/2]

virtual void FullPhysics::ProblemState::set ( const ProblemState s)
inlinevirtualinherited

Makes self a copy of the input state.

This method makes the object, for which it is called, a copy of the input state.

Parameters
[in]sanother ProblemState

Definition at line 88 of file problem_state.h.

◆ set_measurement()

void ModelMeasure::set_measurement ( const blitz::Array< double, 1 > &  measurement,
const blitz::Array< double, 1 > &  measurement_error_cov 
)
inherited

For setting measurement and the error covariance matrix.

Parameters
[in]measurementThe measurement to which the model is to be fitted
[in]measurement_error_covThe measurement error covariance matrix assumed to be diagonal (hence simply a vector containing the diagonal)

Definition at line 9 of file model_measure.cc.

◆ uncert_weighted_jac_inner_product()

Array< double, 2 > ModelMeasure::uncert_weighted_jac_inner_product ( )
virtualinherited

Returns the inner product of the matrix returned by the method uncert_weighted_jacobian() by itself.

Let the following be the computed model Jacobian and the measurement error covariance matrix respectively:

  • K
  • Se

Then this method returns

\[ K^TS_e^{-1}K \]

Returns
The inner product of the matrix returned by the method uncert_weighted_jacobian() by itself.

Definition at line 54 of file model_measure.cc.

◆ uncert_weighted_jacobian()

Array< double, 2 > ModelMeasure::uncert_weighted_jacobian ( )
virtualinherited

Returns the model Jacobian weighted by the inverse of the Cholesky decomposition of the error covariance matrix.

This method is for convenience. It returns the model Jacobian weighted by the Cholesky decomposition (roughly speaking the square root) of the error covariance matrix.

Let the following be the computed model Jacobian and the measurement error covariance matrix respectively:

  • K
  • Se

Then the Cholesky decomposition of the error covariance matrix is

\[ S_e = C_e C_e^T \]

and this method returns

\[ C_e^{-1}K \]

The method uncert_weighted_model_measure_diff() is another function of the parameters, and the method uncert_weighted_jacobian() is the Jacobian of uncert_weighted_model_measure_diff().

Returns
Model Jacobian weighted by the inverse of the Cholesky decomposition of the error covariance matrix

Definition at line 45 of file model_measure.cc.

◆ uncert_weighted_model_measure_diff()

virtual blitz::Array<double, 1> FullPhysics::ModelMeasure::uncert_weighted_model_measure_diff ( )
inlinevirtualinherited

Returns model and measurement difference weighted by the inverse of the Cholesky decomposition of the error covariance matrix.

This method is for convenience. It returns the difference of the computed model and measurement, model_measure_diff(), weighted by the Cholesky decomposition (roughly speaking the square root) of the error covariance matrix. In the name of this method "uncert" is the short for uncertainty, but probably using the word uncertainty or uncert in the name of this method is a bad Idea. In the implementation of this class the error covariance matrix is implemented as a diagonal matrix. However, if the matrix were not diagonal, still the purpose of this method would be to weight the model and the measurement difference with the Cholesky decomposition of the entire error covariance matrix.

Let the following be the computed model, the measured data, and the measurement error covariance matrix respectively:

  • M
  • S
  • Se

Then the Cholesky decomposition of the error covariance matrix is

\[ S_e = C_e C_e^T \]

and this method returns

\[ C_e^{-1}(M-S) \]

Returns
Model and measurement difference weighted by the inverse of the Cholesky decomposition of the error covariance matrix

Definition at line 451 of file model_measure.h.

Member Data Documentation

◆ K

blitz::Array<double, 2> FullPhysics::ModelState::K
protectedinherited

Definition at line 99 of file model_state.h.

◆ M

blitz::Array<double, 1> FullPhysics::ModelState::M
protectedinherited

Definition at line 98 of file model_state.h.

◆ msrmnt

blitz::Array<double, 1> FullPhysics::ModelMeasure::msrmnt
protectedinherited

Definition at line 512 of file model_measure.h.

◆ Se

blitz::Array<double, 1> FullPhysics::ModelMeasure::Se
protectedinherited

Definition at line 513 of file model_measure.h.

◆ Se_chol

blitz::Array<double, 1> FullPhysics::ModelMeasure::Se_chol
protectedinherited

Definition at line 516 of file model_measure.h.

◆ X

blitz::Array<double, 1> FullPhysics::ProblemState::X
protectedinherited

Definition at line 222 of file problem_state.h.


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

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:13