gtsam
Loading...
Searching...
No Matches
gtsam::noiseModel::mEstimator::TruncatedLeastSquares Class Reference

Detailed Description

Truncated Least Squares (TLS) robust error model.

This model has a scalar parameter "c" (threshold).

  • Loss \rho(x) = 0.5 x^2 if |x|<=c, 0.5 c^2 otherwise
  • Derivative \phi(x) = x if |x|<=c, 0 otherwise
  • Weight w(x) = \phi(x)/x = 1 if |x|<=c, 0 otherwise

    TLS has three graduated forms. All are stated in terms of the normalized \mu; the historical Yang/Peng parameter is \theta = \mu / (1 - \mu), which GncOptimizer schedules under the loss-independent name \lambda.

    STANDARD TLS loss is graduated by relaxing the threshold with \lambda = 1 / \mu, i.e. by replacing c² with c²/\mu.

  • Loss \rho(x,\mu) = 0.5 x^2 if x^2 <= c^2/\mu, 0.5 c^2/\mu otherwise
  • Weight w(x,\mu) = 1 if x^2 <= c^2/\mu, 0 otherwise

    GNC_LINEAR is the normalized Yang GNC-TLS surrogate LB = \mu c^2 UB = c^2 / \mu

  • Loss \rho(x,\mu) = 0.5 x^2 if x^2 < LB = 0.5 (2\sqrt(\mu c^2 x^2) - \mu(c^2 + x^2))/(1-\mu) if LB < x^2 < UB = 0.5 c^2 if UB < x^2
  • Weight w(x,\mu) = 1 if x^2 < LB = (\sqrt(\mu c^2 / x^2) - \mu)/(1-\mu) if LB < x^2 < UB = 0 if UB < x^2 Yang's \theta -> 0 surrogate is degenerate (every weight vanishes), so the \mu = 0 endpoint is defined to be the all-inlier least-squares initialization step: w = 1 and \rho = 0.5 x^2. \mu = 1 is exact TLS.

GNC_SUPERLINEAR is the normalized Peng MS-GNC-TLS majorizer LB = c^2 UB = c^2 / \mu^2

  • Loss \rho(x, \mu) = (not formally defined)
  • Weight w(x, \mu) = 1 if x^2 < LB = (\sqrt(c^2 / x^2) - \mu)/(1-\mu) if LB < x^2 < UB = 0 if UB < x^2 Its \mu = 0 endpoint is the non-degenerate convex weight min(1, c/|x|), so unlike GNC_LINEAR it needs no separate initialization convention. \mu = 1 is exact TLS.
Inheritance diagram for gtsam::noiseModel::mEstimator::TruncatedLeastSquares:

Public Member Functions

 TruncatedLeastSquares (double c=1.0, const ReweightScheme reweight=Block)
 Construct standard TLS loss.
 TruncatedLeastSquares (double c, GradScheme graduation, const ReweightScheme reweight=Block)
 Construct with an explicit graduation scheme.
double weight (double distance) const override
 This method is responsible for returning the weight function for a given amount of error.
double loss (double distance) const override
 This method is responsible for returning the total penalty for a given amount of error.
double graduatedWeight (double distance, double mu) const override
 This method is responsible for returning the weight for a given amount of error and the current control parameter \(\mu\).
double graduatedLoss (double distance, double mu) const override
 This method is responsible for returning the total penalty for a given amount of error and the current control parameter \(\mu\).
void print (const std::string &s) const override
bool equals (const Base &expected, double tol=1e-8) const override
double modelParameter () const
GradScheme gradScheme () const
 Returns the graduation scheme used by this loss.
Public Member Functions inherited from gtsam::noiseModel::mEstimator::Base
 Base (const ReweightScheme reweight=Block)
ReweightScheme reweightScheme () const
 Returns the reweight scheme, as explained in ReweightScheme.
double sqrtWeight (double distance) const
Vector weight (const Vector &error) const
 produce a weight vector according to an error vector and the implemented robust function
Vector sqrtWeight (const Vector &error) const
 square root version of the weight function
void reweight (Vector &error) const
 reweight block matrices and a vector according to their weight implementation
void reweight (std::vector< Matrix > &A, Vector &error) const
void reweight (Matrix &A, Vector &error) const
void reweight (Matrix &A1, Matrix &A2, Vector &error) const
void reweight (Matrix &A1, Matrix &A2, Matrix &A3, Vector &error) const

Static Public Member Functions

static shared_ptr Create (double c, const ReweightScheme reweight=Block)
static shared_ptr Create (double c, GradScheme graduation, const ReweightScheme reweight=Block)
 Factory for a loss with an explicit graduation scheme.
static double Weight (double distance2, double c2)
 Static implementation of TLS Weight.
static double Loss (double distance2, double c2)
 Static implementation of TLS Loss.
static double GraduatedWeight (double distance2, double c2, double mu, GradScheme graduation)
 Static implementation of TLS Graduated Weight.
static double GraduatedLoss (double distance2, double c2, double mu, GradScheme graduation)
 Static implementation of TLS Graduated Loss.

Public Types

enum  GradScheme { STANDARD , GNC_LINEAR , GNC_SUPERLINEAR }
typedef std::shared_ptr< TruncatedLeastSquares > shared_ptr
Public Types inherited from gtsam::noiseModel::mEstimator::Base
enum  ReweightScheme { Scalar , Block }
 the rows can be weighted independently according to the error or uniformly with the norm of the right hand side
typedef std::shared_ptr< Base > shared_ptr

Protected Attributes

double c_
double csquared_
GradScheme graduation_
Protected Attributes inherited from gtsam::noiseModel::mEstimator::Base
ReweightScheme reweight_
 Strategy for reweighting.

Member Function Documentation

◆ equals()

bool gtsam::noiseModel::mEstimator::TruncatedLeastSquares::equals ( const Base & expected,
double tol = 1e-8 ) const
overridevirtual

◆ graduatedLoss()

double gtsam::noiseModel::mEstimator::TruncatedLeastSquares::graduatedLoss ( double distance,
double mu ) const
overridevirtual

This method is responsible for returning the total penalty for a given amount of error and the current control parameter \(\mu\).

This returns \(\rho(x, \mu)\) in mEstimator

Implements gtsam::noiseModel::mEstimator::Base.

◆ graduatedWeight()

double gtsam::noiseModel::mEstimator::TruncatedLeastSquares::graduatedWeight ( double distance,
double mu ) const
overridevirtual

This method is responsible for returning the weight for a given amount of error and the current control parameter \(\mu\).

This returns \(w(x, \mu)\) in mEstimator

Implements gtsam::noiseModel::mEstimator::Base.

◆ loss()

double gtsam::noiseModel::mEstimator::TruncatedLeastSquares::loss ( double distance) const
overridevirtual

This method is responsible for returning the total penalty for a given amount of error.

For example, this method is responsible for implementing the quadratic function for an L2 penalty, the absolute value function for an L1 penalty, etc.

TODO(mikebosse): When the loss function has as input the norm of the error vector, then it prevents implementations of asymmeric loss functions. It would be better for this function to accept the vector and internally call the norm if necessary.

This returns \(\rho(x)\) in mEstimator

Reimplemented from gtsam::noiseModel::mEstimator::Base.

◆ print()

void gtsam::noiseModel::mEstimator::TruncatedLeastSquares::print ( const std::string & s = "") const
overridevirtual

◆ weight()

double gtsam::noiseModel::mEstimator::TruncatedLeastSquares::weight ( double distance) const
overridevirtual

This method is responsible for returning the weight function for a given amount of error.

The weight function is related to the analytic derivative of the loss function. See https://members.loria.fr/MOBerger/Enseignement/Master2/Documents/ZhangIVC-97-01.pdf for details. This method is required when optimizing cost functions with robust penalties using iteratively re-weighted least squares.

This returns w(x) in mEstimator

Implements gtsam::noiseModel::mEstimator::Base.


The documentation for this class was generated from the following files:
  • /tmp/gtsam-4.3.0-doxygen.rsXPUS/source/gtsam/linear/LossFunctions.h
  • /tmp/gtsam-4.3.0-doxygen.rsXPUS/source/gtsam/linear/LossFunctions.cpp