Ocean
Ocean::Geometry::Estimator Class Reference

This class implements robust estimator functions. More...

Public Types

enum  EstimatorType : uint32_t {
  ET_INVALID = 0u , ET_SQUARE , ET_LINEAR , ET_HUBER ,
  ET_TUKEY , ET_CAUCHY
}
 Definition of individual robust estimator types. More...
 
using EstimatorTypes = std::vector< EstimatorType >
 Definition of a vector holding estimator types. More...
 

Static Public Member Functions

template<EstimatorType tEstimator>
static constexpr bool needSigma ()
 Returns whether an estimator needs a standard deviation for computation. More...
 
template<EstimatorType tEstimator>
static constexpr bool isStandardEstimator ()
 Returns whether an estimator is the standard square error estimator. More...
 
static bool isStandardEstimator (const EstimatorType estimator)
 Returns whether an estimator is the standard square error estimator. More...
 
static bool needSigma (const EstimatorType estimator)
 Returns whether a given estimator needs a standard deviation for computation. More...
 
template<EstimatorType tEstimator>
static Scalar robustError (const Scalar value, const Scalar sigma=0)
 Returns the robust error of a residual error for a specified estimator. More...
 
static Scalar robustError (const Scalar value, const Scalar sigma, const EstimatorType estimator)
 Returns the robust error of a given residual error for a specified estimator. More...
 
template<EstimatorType tEstimator>
static Scalar robustErrorSquare (const Scalar sqrValue, const Scalar sqrSigma=0)
 Returns the robust error of a squared residual error for a specified estimator. More...
 
static Scalar robustErrorSquare (const Scalar sqrValue, const Scalar sqrSigma, const EstimatorType estimator)
 Returns the robust error of a given squared residual error for a specified estimator. More...
 
template<EstimatorType tEstimator>
static Scalar robustWeight (const Scalar value, const Scalar sigma=0)
 Returns the weight in relation to a error for a given residual error and a specified estimator. More...
 
static Scalar robustWeight (const Scalar value, const Scalar sigma, const EstimatorType estimator)
 Returns the weight in relation to a error for a given residual error and a specified estimator. More...
 
template<EstimatorType tEstimator>
static Scalar robustWeightSquare (const Scalar sqrValue, const Scalar sqrSigma=0)
 Returns the weight in relation to a squared error for a given residual error and a specified estimator. More...
 
static Scalar robustWeightSquare (const Scalar sqrValue, const Scalar sqrSigma, const EstimatorType estimator)
 Returns the weight in relation to a squared error for a given residual error and a specified estimator. More...
 
template<EstimatorType tEstimator>
static Scalar determineSigma (const Scalar *errors, const size_t number, const size_t modelParameters)
 Determines the sigma for a specific set of residual errors and a specified estimator. More...
 
static Scalar determineSigma (const Scalar *errors, const size_t number, const size_t modelParameters, const EstimatorType estimator)
 Determines the sigma for a specific set of residual errors and a specified estimator. More...
 
template<EstimatorType tEstimator>
static Scalar determineSigma (const Scalar *errors, const unsigned int *indices, const size_t numberIndices, const size_t modelParameters)
 Determines the sigma for a specific subset of residual errors and a specified estimator. More...
 
static Scalar determineSigma (const Scalar *errors, const unsigned int *indices, const size_t numberIndices, const size_t modelParameters, const EstimatorType estimator)
 Determines the sigma for a specific subset of residual errors and a specified estimator. More...
 
template<EstimatorType tEstimator>
static Scalar determineSigmaSquare (const Scalar *sqrErrors, const size_t number, const size_t modelParameters)
 Determines the squared sigma for a specific set of squared residual errors and a specified estimator. More...
 
static Scalar determineSigmaSquare (const Scalar *sqrErrors, const size_t number, const size_t modelParameters, const EstimatorType estimator)
 Determines the squared sigma for a specific set of squared residual errors and a specified estimator. More...
 
template<EstimatorType tEstimator>
static Scalar determineSigmaSquare (const Scalar *sqrErrors, const unsigned int *indices, const size_t numberIndices, const size_t modelParameters)
 Determines the squared sigma for a specific set of squared residual errors and a specified estimator. More...
 
static Scalar determineSigmaSquare (const Scalar *sqrErrors, const unsigned int *indices, const size_t numberIndices, const size_t modelParameters, const EstimatorType estimator)
 Determines the squared sigma for a specific set of squared residual errors and a specified estimator. More...
 
template<Estimator::EstimatorType tEstimator>
static Scalar determineRobustError (const Scalar *sqrErrors, const size_t number, const size_t modelParameters)
 Determines the overall robust error for set of given squared errors, a specified estimator and the dimension of the model. More...
 
static constexpr Scalar maximalWeight ()
 Returns the maximal weight for any estimator which is used to clamp extremely high weights (for tiny errors). More...
 
static constexpr Scalar invMaximalWeight ()
 Returns the inverse maximal weight for any estimator which is used to clamp extremely high weights (for tiny errors). More...
 
static std::string translateEstimatorType (const EstimatorType estimatorType)
 Translates a given estimator type into a readable string. More...
 
static EstimatorType translateEstimatorType (const std::string &estimatorType)
 Translates a readable name of an estimator type to it's value. More...
 
static const EstimatorTypesestimatorTypes ()
 Returns all existing valid estimator types. More...
 

Static Protected Member Functions

template<EstimatorType tEstimator>
static Scalar sigmaTuningContstant ()
 Returns the tuning constant allowing to determine a 95 percent efficiency on the standard normal distribution for individual estimators. More...
 

Detailed Description

This class implements robust estimator functions.

See 'Parameter Estimation Techniques: A Tutorial with Application to Conic Fitting', Zhengyou Zhang, 1997 for detailed information.

Member Typedef Documentation

◆ EstimatorTypes

Definition of a vector holding estimator types.

Member Enumeration Documentation

◆ EstimatorType

Definition of individual robust estimator types.

Enumerator
ET_INVALID 

An invalid estimator type.

ET_SQUARE 

The standard square error estimator (L2).

The estimation function is defined by:

p(x) = x^2 / 2

The weighting function is given by:

w(x) = 1
ET_LINEAR 

The linear estimator (L1).

The estimation function is defined by:

p(x) = |x|

The weighting function is given by:

w(x) = 1 / |x|
ET_HUBER 

The Huber estimator type.

The estimation function is defined by:

p(x, s) = x^2 / 2,            if |x| <= s
        = s * (|x| - s / 2),  else

The weighting function is given by:

w(x, s) = 1,        if |x| <= s
        = s / |x|,  else

The sigma tuning constant is given as: 1.345

ET_TUKEY 

The Tukey estimator.

The estimation function is defined by:

p(x, s) = s^2 / 6 * (1 - (1 - (x / s)^2)^3),  if |x| <= s
        = s^2 / 6,                            else

The weighting function is given by:

w(x, s) = (1 - (x / s)^2)^2,  if |x| <= s
        = 0,                  else

The sigma tuning constant is given as: 4.6851

ET_CAUCHY 

The Cauchy estimator.

The estimation function is defined by:

p(x, s) = s^2 / 2 * log(1 + (x / s)^2)

The weighting function is defined by:

w(x, s) = 1 / (1 + (x / s)^2)

The sigma tuning constant is given as: 2.3849

Member Function Documentation

◆ determineRobustError()

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::Estimator::determineRobustError ( const Scalar sqrErrors,
const size_t  number,
const size_t  modelParameters 
)
inlinestatic

Determines the overall robust error for set of given squared errors, a specified estimator and the dimension of the model.

Parameters
sqrErrorsThe squared error values for which the overall robust error will be determined
numberThe number of provided squared error values, with range [1, infinity)
modelParametersNumber of parameters that define the model that has to be optimized (the dimension of the model), with range [1, infinity)
Returns
Resulting overall robust error for the given set of squared errors
Template Parameters
tEstimatorRobust error estimator to be used

◆ determineSigma() [1/4]

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::Estimator::determineSigma ( const Scalar errors,
const size_t  number,
const size_t  modelParameters 
)
inlinestatic

Determines the sigma for a specific set of residual errors and a specified estimator.

Parameters
errorsResidual errors for that the corresponding sigma has to be determined
numberThe number of provided residual errors, with range [1, infinity)
modelParametersNumber of the parameter that define the model
Returns
Resulting sigma
Template Parameters
tEstimatorType of the estimator to use

◆ determineSigma() [2/4]

Scalar Ocean::Geometry::Estimator::determineSigma ( const Scalar errors,
const size_t  number,
const size_t  modelParameters,
const EstimatorType  estimator 
)
inlinestatic

Determines the sigma for a specific set of residual errors and a specified estimator.

Parameters
errorsResidual errors for that the corresponding sigma has to be determined
numberThe number of provided residual errors, with range [1, infinity)
modelParametersNumber of the parameter that define the model
estimatorType of the estimator to use
Returns
Resulting sigma

◆ determineSigma() [3/4]

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::Estimator::determineSigma ( const Scalar errors,
const unsigned int *  indices,
const size_t  numberIndices,
const size_t  modelParameters 
)
inlinestatic

Determines the sigma for a specific subset of residual errors and a specified estimator.

Parameters
errorsResidual errors for that the corresponding sigma has to be determined
indicesIndices of the subset of the residual errors, beware: no range check is applied
numberIndicesNumber of provided indices, with range [1, infinity)
modelParametersNumber of the parameter that define the model, with range [1, infinity)
Returns
Resulting sigma
Template Parameters
tEstimatorType of the estimator to use

◆ determineSigma() [4/4]

Scalar Ocean::Geometry::Estimator::determineSigma ( const Scalar errors,
const unsigned int *  indices,
const size_t  numberIndices,
const size_t  modelParameters,
const EstimatorType  estimator 
)
inlinestatic

Determines the sigma for a specific subset of residual errors and a specified estimator.

Parameters
errorsResidual errors for that the corresponding sigma has to be determined
indicesIndices of the subset of the residual errors, beware: no range check is applied
numberIndicesNumber of provided indices, with range [1, infinity)
modelParametersNumber of the parameter that define the model
estimatorType of the estimator to use
Returns
Resulting sigma

◆ determineSigmaSquare() [1/4]

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::Estimator::determineSigmaSquare ( const Scalar sqrErrors,
const size_t  number,
const size_t  modelParameters 
)
inlinestatic

Determines the squared sigma for a specific set of squared residual errors and a specified estimator.

Parameters
sqrErrorsSquared residual errors for that the corresponding sigma has to be determined
numberThe number of provided residual errors, with range [1, infinity)
modelParametersNumber of the parameter that define the model
Returns
Resulting sigma (not the squared sigma)
Template Parameters
tEstimatorType of the estimator to use

◆ determineSigmaSquare() [2/4]

Scalar Ocean::Geometry::Estimator::determineSigmaSquare ( const Scalar sqrErrors,
const size_t  number,
const size_t  modelParameters,
const EstimatorType  estimator 
)
inlinestatic

Determines the squared sigma for a specific set of squared residual errors and a specified estimator.

Parameters
sqrErrorsSquared residual errors for that the corresponding sigma has to be determined
numberThe number of provided residual errors, with range [1, infinity)
modelParametersNumber of the parameter that define the model
estimatorType of the estimator to use
Returns
Resulting sigma (not the squared sigma)

◆ determineSigmaSquare() [3/4]

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::Estimator::determineSigmaSquare ( const Scalar sqrErrors,
const unsigned int *  indices,
const size_t  numberIndices,
const size_t  modelParameters 
)
inlinestatic

Determines the squared sigma for a specific set of squared residual errors and a specified estimator.

Parameters
sqrErrorsSquared residual errors for that the corresponding sigma has to be determined
indicesIndices of the subset of the residual errors, beware: no range check is applied
numberIndicesNumber of provided indices, with range [1, infinity)
modelParametersNumber of the parameter that define the model
Returns
Resulting sigma (not the squared sigma)
Template Parameters
tEstimatorType of the estimator to use

◆ determineSigmaSquare() [4/4]

Scalar Ocean::Geometry::Estimator::determineSigmaSquare ( const Scalar sqrErrors,
const unsigned int *  indices,
const size_t  numberIndices,
const size_t  modelParameters,
const EstimatorType  estimator 
)
inlinestatic

Determines the squared sigma for a specific set of squared residual errors and a specified estimator.

Parameters
sqrErrorsSquared residual errors for that the corresponding sigma has to be determined
indicesIndices of the subset of the residual errors, beware: no range check is applied
numberIndicesNumber of provided indices, with range [1, infinity)
modelParametersNumber of the parameter that define the model
estimatorType of the estimator to use
Returns
Resulting sigma (not the squared sigma)

◆ estimatorTypes()

static const EstimatorTypes& Ocean::Geometry::Estimator::estimatorTypes ( )
static

Returns all existing valid estimator types.

Returns
The valid estimator types

◆ invMaximalWeight()

constexpr Scalar Ocean::Geometry::Estimator::invMaximalWeight ( )
staticconstexpr

Returns the inverse maximal weight for any estimator which is used to clamp extremely high weights (for tiny errors).

Returns
Returns 1 / maximalWeight()

◆ isStandardEstimator() [1/2]

template<Estimator::EstimatorType tEstimator>
constexpr bool Ocean::Geometry::Estimator::isStandardEstimator
staticconstexpr

Returns whether an estimator is the standard square error estimator.

Returns
True, if so
Template Parameters
tEstimatorEstimator to check

◆ isStandardEstimator() [2/2]

bool Ocean::Geometry::Estimator::isStandardEstimator ( const EstimatorType  estimator)
inlinestatic

Returns whether an estimator is the standard square error estimator.

Parameters
estimatorThe estimator to check
Returns
True, if so

◆ maximalWeight()

constexpr Scalar Ocean::Geometry::Estimator::maximalWeight ( )
staticconstexpr

Returns the maximal weight for any estimator which is used to clamp extremely high weights (for tiny errors).

Returns
The maximal weight to be applied

◆ needSigma() [1/2]

template<Estimator::EstimatorType tEstimator>
constexpr bool Ocean::Geometry::Estimator::needSigma
staticconstexpr

Returns whether an estimator needs a standard deviation for computation.

Template Parameters
tEstimatorEstimator for that the dependency is requested
Returns
True, if so

◆ needSigma() [2/2]

bool Ocean::Geometry::Estimator::needSigma ( const EstimatorType  estimator)
inlinestatic

Returns whether a given estimator needs a standard deviation for computation.

Parameters
estimatorThe estimator for that the dependency is requested
Returns
True, if so

◆ robustError() [1/2]

Scalar Ocean::Geometry::Estimator::robustError ( const Scalar  value,
const Scalar  sigma,
const EstimatorType  estimator 
)
inlinestatic

Returns the robust error of a given residual error for a specified estimator.

Parameters
valueResidual error to return the robust error for, with range (-infinity, infinity)
sigmaStandard deviation of the expected residual error, with range (0, infinity) if 'needSigma(estimator) == false', otherwise 0
estimatorType of the estimator to use
Returns
The resulting robust error, with range [0, infinity)
See also
needSigma().

◆ robustError() [2/2]

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::Estimator::robustError ( const Scalar  value,
const Scalar  sigma = 0 
)
inlinestatic

Returns the robust error of a residual error for a specified estimator.

Parameters
valueResidual error to return the robust error for, with range (-infinity, infinity)
sigmaStandard deviation of the expected residual error, with range (0, infinity) if 'needSigma<tEstimator>() == false', otherwise 0
Returns
The resulting robust error, with range [0, infinity)
Template Parameters
tEstimatorType of the estimator to use
See also
needSigma().

◆ robustErrorSquare() [1/2]

Scalar Ocean::Geometry::Estimator::robustErrorSquare ( const Scalar  sqrValue,
const Scalar  sqrSigma,
const EstimatorType  estimator 
)
inlinestatic

Returns the robust error of a given squared residual error for a specified estimator.

Parameters
sqrValueResidual error to return the robust error for, with range [0, infinity)
sqrSigmaStandard deviation of the expected residual error, with range (0, infinity) if 'needSigma(estimator) == false', otherwise 0
estimatorType of the estimator to use
Returns
The resulting robust error, with range [0, infinity)
See also
needSigma().

◆ robustErrorSquare() [2/2]

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::Estimator::robustErrorSquare ( const Scalar  sqrValue,
const Scalar  sqrSigma = 0 
)
inlinestatic

Returns the robust error of a squared residual error for a specified estimator.

Parameters
sqrValueSquared residual error to return the robust error for, with range [0, infinity)
sqrSigmaStandard deviation of the expected residual error, with range (0, infinity) if 'needSigma<tEstimator>() == false', otherwise 0
Returns
The resulting robust error, with range [0, infinity)
Template Parameters
tEstimatorType of the estimator to use
See also
needSigma().

◆ robustWeight() [1/2]

Scalar Ocean::Geometry::Estimator::robustWeight ( const Scalar  value,
const Scalar  sigma,
const EstimatorType  estimator 
)
inlinestatic

Returns the weight in relation to a error for a given residual error and a specified estimator.

Parameters
valueResidual error to return the weight for
sigmaStandard deviation of the expected residual error
estimatorType of the estimator to use
Returns
Resulting weight

◆ robustWeight() [2/2]

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::Estimator::robustWeight ( const Scalar  value,
const Scalar  sigma = 0 
)
inlinestatic

Returns the weight in relation to a error for a given residual error and a specified estimator.

Parameters
valueResidual error to return the weight for
sigmaStandard deviation of the expected residual error, beware: provide a valid standard deviation if necessary with range (0, infinity)
Returns
Resulting weight
Template Parameters
tEstimatorType of the estimator to use

◆ robustWeightSquare() [1/2]

Scalar Ocean::Geometry::Estimator::robustWeightSquare ( const Scalar  sqrValue,
const Scalar  sqrSigma,
const EstimatorType  estimator 
)
inlinestatic

Returns the weight in relation to a squared error for a given residual error and a specified estimator.

Parameters
sqrValueSquared residual error to return the weight for
sqrSigmaSquared standard deviation of the expected residual error
estimatorType of the estimator to use
Returns
Resulting weight (not the squared result), with range [0, infinity)

◆ robustWeightSquare() [2/2]

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::Estimator::robustWeightSquare ( const Scalar  sqrValue,
const Scalar  sqrSigma = 0 
)
inlinestatic

Returns the weight in relation to a squared error for a given residual error and a specified estimator.

Parameters
sqrValueSquared residual error to return the weight for
sqrSigmaSquared standard deviation of the expected residual error, beware: provide a valid standard deviation if necessary with range (0, infinity)
Returns
Resulting weight (not the squared result), with range [0, infinity)
Template Parameters
tEstimatorType of the estimator to use

◆ sigmaTuningContstant()

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::Estimator::sigmaTuningContstant
inlinestaticprotected

Returns the tuning constant allowing to determine a 95 percent efficiency on the standard normal distribution for individual estimators.

Returns
Tuning constant

◆ translateEstimatorType() [1/2]

static std::string Ocean::Geometry::Estimator::translateEstimatorType ( const EstimatorType  estimatorType)
static

Translates a given estimator type into a readable string.

Parameters
estimatorTypeThe type of the estimator to translate
Returns
The readable string, 'Invalid' if unknown

◆ translateEstimatorType() [2/2]

static EstimatorType Ocean::Geometry::Estimator::translateEstimatorType ( const std::string &  estimatorType)
static

Translates a readable name of an estimator type to it's value.

Parameters
estimatorTypeThe name of the estimator type for which the value will be returned
Returns
The estimator type, ET_INVALID if invalid

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