Isis 3 Programmer Reference
Isis::MaximumLikelihoodWFunctions Class Reference

Class provides maximum likelihood estimation functions for robust parameter estimation, e.g. More...

#include <MaximumLikelihoodWFunctions.h>

Collaboration diagram for Isis::MaximumLikelihoodWFunctions:
Collaboration graph

Public Types

enum  Model { Huber , HuberModified , Welsch , Chen }
 The supported maximum likelihood estimation models. More...
 

Public Member Functions

 MaximumLikelihoodWFunctions ()
 Sets up a maximumlikelihood estimation function with Huber model and default tweaking constant.
 
 MaximumLikelihoodWFunctions (Model modelSelection)
 Sets up a maximumlikelihood estimation function with specified model and default tweaking constant.
 
 MaximumLikelihoodWFunctions (Model modelSelection, double tweakingConstant)
 Sets up a maximumlikelihood estimation function with specified model and tweaking constant.
 
 MaximumLikelihoodWFunctions (const MaximumLikelihoodWFunctions &other)
 
MaximumLikelihoodWFunctionsoperator= (const MaximumLikelihoodWFunctions &other)
 
void setModel (Model modelSelection)
 Allows the maximum likelihood model to be changed together and the default tweaking constant to be set.
 
void setTweakingConstantDefault ()
 Sets default tweaking constants based on the maximum likelihood estimation model being used.
 
void setModel (Model modelSelection, double tweakingConstant)
 Allows the maximum likelihood model to be changed together with the tweaking constant.
 
void setTweakingConstant (double tweakingConstant)
 Allows the tweaking constant to be changed without changing the maximum likelihood function.
 
Model model () const
 Accessor method to return the MaximumLikelihoodWFunctions::Model enumeration.
 
double tweakingConstant () const
 Returns the current tweaking constant.
 
double sqrtWeightScaler (double residualZScore)
 This provides the scaler to the sqrt of the weight, which is very useful for building normal equations.
 
double tweakingConstantQuantile ()
 Suggest a quantile of the probility distribution of the residuals to use as the tweaking constants based on the maximum likelihood estimation model being used.
 
QString weightedResidualCutoff ()
 Method to return a string represtentation of the weighted residual cutoff (if it exists) for the MaximumLikelihoodWFunctions::Model.
 
QDataStream & write (QDataStream &stream) const
 
QDataStream & read (QDataStream &stream)
 

Static Public Member Functions

static QString modelToString (Model model)
 Static method to return a string represtentation for a given MaximumLikelihoodWFunctions::Model enum.
 
static MaximumLikelihoodWFunctions::Model stringToModel (QString modelName)
 

Private Member Functions

double weightScaler (double residualZScore)
 This provides the scalar for the weight (not the scaler for the square root of the weight, which is generally more useful)
 
double huber (double residualZScore)
 Huber maximum likelihood estimation function evaluation.
 
double huberModified (double residualZScore)
 Modified Huber maximum likelihood estimation function evaluation.
 
double welsch (double residualZScore)
 Modified Huber maximum likelihood estimation function evaluation.
 
double chen (double residualZScore)
 Modified Huber maximum likelihood estimation function evaluation.
 

Private Attributes

Model m_model
 The enumerated value for the maximum likelihood estimation model to be used.
 
double m_tweakingConstant
 The tweaking constant for the maximum likelihood models.
 

Detailed Description

Class provides maximum likelihood estimation functions for robust parameter estimation, e.g.

in bundle adjustment.

A maximum likelihood estimation W function provides a scheme for 're-weighting' observations so that measures with large residuals have reduced or negligible effect on the solution. There are many such functions available, a few have been programmed into this class. See enum Model documentation for specifics of the estimation models.

References: Zhangs, "Parameter Estimation: A Tutorial with Application to Conic Fitting" Koch, "Parameter Estimation and Hypothesis Testing in Linear Systems" 2nd edition, chapter 3.8 Manual of Photogrammetry, 5th edition, chapter 2.2 (particularly 2.2.6) Chen, "Robust Regression with Projection Based M-estimators"

Author
2012-03-23 Orrin Thomas
History

2012-03-23 Orrin Thomas - Original Version

2014-06-23 Jeannie Backer - Moved method implementation to cpp file and other ISIS coding standards fixes.

2014-07-03 Jeannie Backer - Replace member variable m_PI with Isis constant

2014-07-16 Jeannie Backer - Added enum to QString method and its inverse.

2014-07-23 Jeannie Backer - Added QDataStream >> and << operators and read/write methods.

2014-09-19 Jeannie Backer - Removed bugs. Added documentation. Cleaned duplicate code.

2018-06-29 Christopher Combs - Added extra HuberModified case to stringToModel(). Fixes #5446.

Definition at line 49 of file MaximumLikelihoodWFunctions.h.

Member Enumeration Documentation

◆ Model

The supported maximum likelihood estimation models.

Enumerator
Huber 

According to Zhang (Parameter Estimation: A Tutorial with application to conic fitting) "[Huber's] estimator is so satisfactory this is has been recommended for almost all situations; very rarely has it been found to be inferior to some other function.

" Its one deficiency is the discontinuous second derivative which cause rare diffeculites. No measures are totally disregarded. http://research.microsoft.com/en-us/um/people/zhang/Papers/ZhangIVC-97-01.pdf

HuberModified 

A modification to Huber's method propsed by William J.J.

Rey in Introduction to Robust and Quasi-Robust Statistical Methods. Springer, Berlin, Heidelberg, 1983. It has similiar properties to the Huber, but with a continuous second derivative. This comes at the cost of being somewhat more computationally expernsive. No measures are totally disregarded. http://research.microsoft.com/en-us/um/people/zhang/Papers/ZhangIVC-97-01.pdf

Welsch 

The Welsch method aggresively discounts measures with large resiudals.

Residuals two times greater than the tweaking constant are all but ignored. This method can be risky to use (at least at first) because it does not gaurantee a unique solution. And if sufficient measures are effectively 'removed' by the weighting, the system can become singular. The manual of photogrammetry recommended using it for clean up after convergeance or near convergence had been optained with a more stable method (such as Huber's). http://research.microsoft.com/en-us/um/people/zhang/Papers/ZhangIVC-97-01.pdf

Chen 

The Chen method was found in "Robust Regression with Projection Based M-estimators" Chen, et.

al., though Chen does not take credit as the author. It was of interest because he seemed to present its use as expected in systems with large numbers of outliers, and because of it's unique properties. It is exceptionally aggresive. Residuals less than the tweaking constant generally have MORE influence than in standard least squares (or any other estimation function I've studied), and residuals larger than the tweaking function are totaly discounted.

Definition at line 56 of file MaximumLikelihoodWFunctions.h.

Constructor & Destructor Documentation

◆ MaximumLikelihoodWFunctions() [1/4]

Isis::MaximumLikelihoodWFunctions::MaximumLikelihoodWFunctions ( )

Sets up a maximumlikelihood estimation function with Huber model and default tweaking constant.

Definition at line 25 of file MaximumLikelihoodWFunctions.cpp.

References Huber, and setModel().

◆ MaximumLikelihoodWFunctions() [2/4]

Isis::MaximumLikelihoodWFunctions::MaximumLikelihoodWFunctions ( Model modelSelection)

Sets up a maximumlikelihood estimation function with specified model and default tweaking constant.

Parameters
[in]enumModel modelSelection, the model to be used (see documentation for enum Model)

Definition at line 38 of file MaximumLikelihoodWFunctions.cpp.

References setModel().

◆ MaximumLikelihoodWFunctions() [3/4]

Isis::MaximumLikelihoodWFunctions::MaximumLikelihoodWFunctions ( Model modelSelection,
double tweakingConstant )

Sets up a maximumlikelihood estimation function with specified model and tweaking constant.

Parameters
[in]enumModel modelSelection, the model to be used (see documentation for enum Model)
[in]doubletweaking constant, exact meaning varies by model, but generally the larger the value the more influence larger resiudals have on the solution. As well as possibly the more measures are included in the solution.
Exceptions
IsisProgrammerErrorif tweakingConstant <= 0.0

Definition at line 56 of file MaximumLikelihoodWFunctions.cpp.

References setModel(), and tweakingConstant().

◆ MaximumLikelihoodWFunctions() [4/4]

Isis::MaximumLikelihoodWFunctions::MaximumLikelihoodWFunctions ( const MaximumLikelihoodWFunctions & other)

Definition at line 62 of file MaximumLikelihoodWFunctions.cpp.

◆ ~MaximumLikelihoodWFunctions()

Isis::MaximumLikelihoodWFunctions::~MaximumLikelihoodWFunctions ( )

Definition at line 69 of file MaximumLikelihoodWFunctions.cpp.

Member Function Documentation

◆ chen()

double Isis::MaximumLikelihoodWFunctions::chen ( double residualZScore)
private

Modified Huber maximum likelihood estimation function evaluation.

For details, see documentation of enum Model.

Parameters
[in]doubleresidualZScore, this the residual of a particulare measure in a particular iteration divided by the standard deviation (sigma) of that measure
Returns
double the scaler adjustment to the weight for the measure nominal weight = 1 /sigma/sigma and weight' = scaler/sigma/sigma

Definition at line 302 of file MaximumLikelihoodWFunctions.cpp.

References m_tweakingConstant.

Referenced by weightScaler().

◆ huber()

double Isis::MaximumLikelihoodWFunctions::huber ( double residualZScore)
private

Huber maximum likelihood estimation function evaluation.

For details, see documentation of the enum, MaximumLikelihoodWFunctions::Model

Parameters
[in]doubleresidualZScore, this the residual of a particulare measure in a particular iteration divided by the standard deviation (sigma) of that measure
Returns
double the scaler adjustment to the weight for the measure nominal weight = 1 /sigma/sigma and weight' = scaler/sigma/sigma

Definition at line 240 of file MaximumLikelihoodWFunctions.cpp.

References m_tweakingConstant.

Referenced by weightScaler().

◆ huberModified()

double Isis::MaximumLikelihoodWFunctions::huberModified ( double residualZScore)
private

Modified Huber maximum likelihood estimation function evaluation.

For details see documentation of enum Model

Parameters
[in]doubleresidualZScore, this the residual of a particulare measure in a particular iteration divided by the standard deviation (sigma) of that measure
Returns
double the scaler adjustment to the weight for the measure nominal weight = 1 /sigma/sigma and weight' = scaler/sigma/sigma

Definition at line 262 of file MaximumLikelihoodWFunctions.cpp.

References Isis::HALFPI, and m_tweakingConstant.

Referenced by weightScaler().

◆ model()

MaximumLikelihoodWFunctions::Model Isis::MaximumLikelihoodWFunctions::model ( ) const

Accessor method to return the MaximumLikelihoodWFunctions::Model enumeration.

Returns
enum for the maximum likelihood estimation model.

Definition at line 413 of file MaximumLikelihoodWFunctions.cpp.

References m_model.

Referenced by modelToString().

◆ modelToString()

QString Isis::MaximumLikelihoodWFunctions::modelToString ( MaximumLikelihoodWFunctions::Model model)
static

Static method to return a string represtentation for a given MaximumLikelihoodWFunctions::Model enum.

Parameters
modelEnumerated value for a MaximumLikelihoodWFunctions model.
Returns
QString label for the enumeration.

Definition at line 355 of file MaximumLikelihoodWFunctions.cpp.

References Chen, Huber, HuberModified, model(), Isis::IException::Programmer, Isis::toString(), and Welsch.

Referenced by Isis::BundleSolutionInfo::outputHeader(), Isis::BundleResults::save(), and Isis::BundleSettings::save().

◆ operator=()

MaximumLikelihoodWFunctions & Isis::MaximumLikelihoodWFunctions::operator= ( const MaximumLikelihoodWFunctions & other)

Definition at line 73 of file MaximumLikelihoodWFunctions.cpp.

◆ read()

QDataStream & Isis::MaximumLikelihoodWFunctions::read ( QDataStream & stream)

Definition at line 427 of file MaximumLikelihoodWFunctions.cpp.

◆ setModel() [1/2]

void Isis::MaximumLikelihoodWFunctions::setModel ( Model modelSelection)

Allows the maximum likelihood model to be changed together and the default tweaking constant to be set.

@Param[in] enum Model modelSelection, the model to be used (see documentation for enum Model)

Definition at line 87 of file MaximumLikelihoodWFunctions.cpp.

References m_model, and setTweakingConstantDefault().

Referenced by MaximumLikelihoodWFunctions(), MaximumLikelihoodWFunctions(), and MaximumLikelihoodWFunctions().

◆ setModel() [2/2]

void Isis::MaximumLikelihoodWFunctions::setModel ( Model modelSelection,
double tweakingConstant )

Allows the maximum likelihood model to be changed together with the tweaking constant.

Parameters
[in]enumModel modelSelection, the model to be used (see documentation for enum Model)
[in]tweakingConstant,exactmeaning varies by model, but generally the larger the value the more influence larger resiudals have on the solution. As well as possibly the more measures are included in the solution.
Exceptions
IsisProgrammerErrorif tweakingConstant <= 0.0

Definition at line 139 of file MaximumLikelihoodWFunctions.cpp.

References m_model, setTweakingConstant(), and tweakingConstant().

◆ setTweakingConstant()

void Isis::MaximumLikelihoodWFunctions::setTweakingConstant ( double tweakingConstant)

Allows the tweaking constant to be changed without changing the maximum likelihood function.

Parameters
[in]tweakingConstant,exactmeaning varies by model, but generally the larger the value the more influence larger resiudals have on the solution. As well as possiblly the more measures are included in the solution.
Exceptions
IsisProgrammerErrorif tweakingConstant <= 0.0

Definition at line 156 of file MaximumLikelihoodWFunctions.cpp.

References m_tweakingConstant, Isis::IException::Programmer, and tweakingConstant().

Referenced by setModel().

◆ setTweakingConstantDefault()

void Isis::MaximumLikelihoodWFunctions::setTweakingConstantDefault ( )

Sets default tweaking constants based on the maximum likelihood estimation model being used.

Definition at line 98 of file MaximumLikelihoodWFunctions.cpp.

References Chen, Huber, HuberModified, m_model, m_tweakingConstant, and Welsch.

Referenced by setModel().

◆ sqrtWeightScaler()

double Isis::MaximumLikelihoodWFunctions::sqrtWeightScaler ( double residualZScore)

This provides the scaler to the sqrt of the weight, which is very useful for building normal equations.

Parameters
[in]doubleresidualZScore, this the residual of a particulare measure in a particular iteration divided by the standard deviation (sigma) of that measure
Returns
double the scaler adjustment to the sqrt of the weight for the measure nominal sqrt(weight) = 1 /sigma and sqrt(weight') = scaler/sigma

Definition at line 217 of file MaximumLikelihoodWFunctions.cpp.

References weightScaler().

Referenced by Isis::BundleAdjust::computePartials().

◆ stringToModel()

MaximumLikelihoodWFunctions::Model Isis::MaximumLikelihoodWFunctions::stringToModel ( QString modelName)
static

Definition at line 367 of file MaximumLikelihoodWFunctions.cpp.

◆ tweakingConstant()

double Isis::MaximumLikelihoodWFunctions::tweakingConstant ( ) const

Returns the current tweaking constant.

Definition at line 170 of file MaximumLikelihoodWFunctions.cpp.

References m_tweakingConstant.

Referenced by MaximumLikelihoodWFunctions(), Isis::BundleSolutionInfo::outputHeader(), setModel(), and setTweakingConstant().

◆ tweakingConstantQuantile()

double Isis::MaximumLikelihoodWFunctions::tweakingConstantQuantile ( )

Suggest a quantile of the probility distribution of the residuals to use as the tweaking constants based on the maximum likelihood estimation model being used.

Returns
double quantile [0,1] the value pretaining to this quantile (in the probility distribution of the residuals) should be used as the tweaking constant.

Definition at line 324 of file MaximumLikelihoodWFunctions.cpp.

References Chen, Huber, HuberModified, m_model, and Welsch.

◆ weightedResidualCutoff()

QString Isis::MaximumLikelihoodWFunctions::weightedResidualCutoff ( )

Method to return a string represtentation of the weighted residual cutoff (if it exists) for the MaximumLikelihoodWFunctions::Model.

If no cutoff exists, the string "N/A" is returned.

Returns
QString label for the weighted residual cut off of the maximum likelihood estimation model.
Exceptions
Estimation model has not been set.

Definition at line 399 of file MaximumLikelihoodWFunctions.cpp.

References Chen, Huber, HuberModified, m_model, m_tweakingConstant, Isis::IException::Programmer, Isis::toString(), and Welsch.

Referenced by Isis::BundleSolutionInfo::outputHeader().

◆ weightScaler()

double Isis::MaximumLikelihoodWFunctions::weightScaler ( double residualZScore)
private

This provides the scalar for the weight (not the scaler for the square root of the weight, which is generally more useful)

Parameters
[in]doubleresidualZScore, this the residual of a particulare measure in a particular iteration divided by the standard deviation (sigma) of that measure
Returns
double the scaler adjustment to the weight for the measure nominal weight = 1 /sigma/sigma and weight' = scaler/sigma/sigma

Definition at line 186 of file MaximumLikelihoodWFunctions.cpp.

References Chen, chen(), Huber, huber(), HuberModified, huberModified(), m_model, Welsch, and welsch().

Referenced by sqrtWeightScaler().

◆ welsch()

double Isis::MaximumLikelihoodWFunctions::welsch ( double residualZScore)
private

Modified Huber maximum likelihood estimation function evaluation.

For details see documentation of enum Model

Parameters
[in]doubleresidualZScore, this the residual of a particulare measure in a particular iteration divided by the standard deviation (sigma) of that measure
Returns
double the scaler adjustment to the weight for the measure nominal weight = 1 /sigma/sigma and weight' = scaler/sigma/sigma

Definition at line 284 of file MaximumLikelihoodWFunctions.cpp.

References m_tweakingConstant.

Referenced by weightScaler().

◆ write()

QDataStream & Isis::MaximumLikelihoodWFunctions::write ( QDataStream & stream) const

Definition at line 419 of file MaximumLikelihoodWFunctions.cpp.

Member Data Documentation

◆ m_model

Model Isis::MaximumLikelihoodWFunctions::m_model
private

The enumerated value for the maximum likelihood estimation model to be used.

Definition at line 142 of file MaximumLikelihoodWFunctions.h.

Referenced by model(), setModel(), setModel(), setTweakingConstantDefault(), tweakingConstantQuantile(), weightedResidualCutoff(), and weightScaler().

◆ m_tweakingConstant

double Isis::MaximumLikelihoodWFunctions::m_tweakingConstant
private

The tweaking constant for the maximum likelihood models.

Default values are available for each model using the method setTweakingConstantDefault(). This value can also be manually adjusted using the method setTweakingConstant(). If there is knowlege of the probility distrubtion of the residuals in an adjustment, tweakingConstantQuantile() will recommend which quantile to use as the tweaking constant.

Definition at line 143 of file MaximumLikelihoodWFunctions.h.

Referenced by chen(), huber(), huberModified(), setTweakingConstant(), setTweakingConstantDefault(), tweakingConstant(), weightedResidualCutoff(), and welsch().


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