rename residual to loss
parent
646a4b7f0f
commit
efcc5c908e
18
gtsam.h
18
gtsam.h
|
@ -1458,7 +1458,7 @@ virtual class Null: gtsam::noiseModel::mEstimator::Base {
|
||||||
void serializable() const;
|
void serializable() const;
|
||||||
|
|
||||||
double weight(double error) const;
|
double weight(double error) const;
|
||||||
double residual(double error) const;
|
double loss(double error) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual class Fair: gtsam::noiseModel::mEstimator::Base {
|
virtual class Fair: gtsam::noiseModel::mEstimator::Base {
|
||||||
|
@ -1469,7 +1469,7 @@ virtual class Fair: gtsam::noiseModel::mEstimator::Base {
|
||||||
void serializable() const;
|
void serializable() const;
|
||||||
|
|
||||||
double weight(double error) const;
|
double weight(double error) const;
|
||||||
double residual(double error) const;
|
double loss(double error) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual class Huber: gtsam::noiseModel::mEstimator::Base {
|
virtual class Huber: gtsam::noiseModel::mEstimator::Base {
|
||||||
|
@ -1480,7 +1480,7 @@ virtual class Huber: gtsam::noiseModel::mEstimator::Base {
|
||||||
void serializable() const;
|
void serializable() const;
|
||||||
|
|
||||||
double weight(double error) const;
|
double weight(double error) const;
|
||||||
double residual(double error) const;
|
double loss(double error) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual class Cauchy: gtsam::noiseModel::mEstimator::Base {
|
virtual class Cauchy: gtsam::noiseModel::mEstimator::Base {
|
||||||
|
@ -1491,7 +1491,7 @@ virtual class Cauchy: gtsam::noiseModel::mEstimator::Base {
|
||||||
void serializable() const;
|
void serializable() const;
|
||||||
|
|
||||||
double weight(double error) const;
|
double weight(double error) const;
|
||||||
double residual(double error) const;
|
double loss(double error) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual class Tukey: gtsam::noiseModel::mEstimator::Base {
|
virtual class Tukey: gtsam::noiseModel::mEstimator::Base {
|
||||||
|
@ -1502,7 +1502,7 @@ virtual class Tukey: gtsam::noiseModel::mEstimator::Base {
|
||||||
void serializable() const;
|
void serializable() const;
|
||||||
|
|
||||||
double weight(double error) const;
|
double weight(double error) const;
|
||||||
double residual(double error) const;
|
double loss(double error) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual class Welsch: gtsam::noiseModel::mEstimator::Base {
|
virtual class Welsch: gtsam::noiseModel::mEstimator::Base {
|
||||||
|
@ -1513,7 +1513,7 @@ virtual class Welsch: gtsam::noiseModel::mEstimator::Base {
|
||||||
void serializable() const;
|
void serializable() const;
|
||||||
|
|
||||||
double weight(double error) const;
|
double weight(double error) const;
|
||||||
double residual(double error) const;
|
double loss(double error) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual class GemanMcClure: gtsam::noiseModel::mEstimator::Base {
|
virtual class GemanMcClure: gtsam::noiseModel::mEstimator::Base {
|
||||||
|
@ -1524,7 +1524,7 @@ virtual class GemanMcClure: gtsam::noiseModel::mEstimator::Base {
|
||||||
void serializable() const;
|
void serializable() const;
|
||||||
|
|
||||||
double weight(double error) const;
|
double weight(double error) const;
|
||||||
double residual(double error) const;
|
double loss(double error) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual class DCS: gtsam::noiseModel::mEstimator::Base {
|
virtual class DCS: gtsam::noiseModel::mEstimator::Base {
|
||||||
|
@ -1535,7 +1535,7 @@ virtual class DCS: gtsam::noiseModel::mEstimator::Base {
|
||||||
void serializable() const;
|
void serializable() const;
|
||||||
|
|
||||||
double weight(double error) const;
|
double weight(double error) const;
|
||||||
double residual(double error) const;
|
double loss(double error) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual class L2WithDeadZone: gtsam::noiseModel::mEstimator::Base {
|
virtual class L2WithDeadZone: gtsam::noiseModel::mEstimator::Base {
|
||||||
|
@ -1546,7 +1546,7 @@ virtual class L2WithDeadZone: gtsam::noiseModel::mEstimator::Base {
|
||||||
void serializable() const;
|
void serializable() const;
|
||||||
|
|
||||||
double weight(double error) const;
|
double weight(double error) const;
|
||||||
double residual(double error) const;
|
double loss(double error) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}///\namespace mEstimator
|
}///\namespace mEstimator
|
||||||
|
|
|
@ -36,12 +36,12 @@ namespace noiseModel {
|
||||||
* The mEstimator name space contains all robust error functions.
|
* The mEstimator name space contains all robust error functions.
|
||||||
* It mirrors the exposition at
|
* It mirrors the exposition at
|
||||||
* https://members.loria.fr/MOBerger/Enseignement/Master2/Documents/ZhangIVC-97-01.pdf
|
* https://members.loria.fr/MOBerger/Enseignement/Master2/Documents/ZhangIVC-97-01.pdf
|
||||||
* which talks about minimizing \sum \rho(r_i), where \rho is a residual function of choice.
|
* which talks about minimizing \sum \rho(r_i), where \rho is a loss function of choice.
|
||||||
*
|
*
|
||||||
* To illustrate, let's consider the least-squares (L2), L1, and Huber estimators as examples:
|
* To illustrate, let's consider the least-squares (L2), L1, and Huber estimators as examples:
|
||||||
*
|
*
|
||||||
* Name Symbol Least-Squares L1-norm Huber
|
* Name Symbol Least-Squares L1-norm Huber
|
||||||
* Residual \rho(x) 0.5*x^2 |x| 0.5*x^2 if |x|<k, 0.5*k^2 + k|x-k| otherwise
|
* Loss \rho(x) 0.5*x^2 |x| 0.5*x^2 if |x|<k, 0.5*k^2 + k|x-k| otherwise
|
||||||
* Derivative \phi(x) x sgn(x) x if |x|<k, k sgn(x) otherwise
|
* Derivative \phi(x) x sgn(x) x if |x|<k, k sgn(x) otherwise
|
||||||
* Weight w(x)=\phi(x)/x 1 1/|x| 1 if |x|<k, k/|x| otherwise
|
* Weight w(x)=\phi(x)/x 1 1/|x| 1 if |x|<k, k/|x| otherwise
|
||||||
*
|
*
|
||||||
|
@ -75,8 +75,8 @@ class GTSAM_EXPORT Base {
|
||||||
* the quadratic function for an L2 penalty, the absolute value function for
|
* the quadratic function for an L2 penalty, the absolute value function for
|
||||||
* an L1 penalty, etc.
|
* an L1 penalty, etc.
|
||||||
*
|
*
|
||||||
* TODO(mikebosse): When the residual function has as input the norm of the
|
* TODO(mikebosse): When the loss function has as input the norm of the
|
||||||
* residual vector, then it prevents implementations of asymmeric loss
|
* error vector, then it prevents implementations of asymmeric loss
|
||||||
* functions. It would be better for this function to accept the vector and
|
* functions. It would be better for this function to accept the vector and
|
||||||
* internally call the norm if necessary.
|
* internally call the norm if necessary.
|
||||||
*/
|
*/
|
||||||
|
@ -89,7 +89,7 @@ class GTSAM_EXPORT Base {
|
||||||
/*
|
/*
|
||||||
* This method is responsible for returning the weight function for a given
|
* This method is responsible for returning the weight function for a given
|
||||||
* amount of error. The weight function is related to the analytic derivative
|
* amount of error. The weight function is related to the analytic derivative
|
||||||
* of the residual function. See
|
* of the loss function. See
|
||||||
* https://members.loria.fr/MOBerger/Enseignement/Master2/Documents/ZhangIVC-97-01.pdf
|
* https://members.loria.fr/MOBerger/Enseignement/Master2/Documents/ZhangIVC-97-01.pdf
|
||||||
* for details. This method is required when optimizing cost functions with
|
* for details. This method is required when optimizing cost functions with
|
||||||
* robust penalties using iteratively re-weighted least squares.
|
* robust penalties using iteratively re-weighted least squares.
|
||||||
|
@ -127,7 +127,7 @@ class GTSAM_EXPORT Base {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Null class is not robust so is a Gaussian ?
|
/// Null class should behave as Gaussian
|
||||||
class GTSAM_EXPORT Null : public Base {
|
class GTSAM_EXPORT Null : public Base {
|
||||||
public:
|
public:
|
||||||
typedef boost::shared_ptr<Null> shared_ptr;
|
typedef boost::shared_ptr<Null> shared_ptr;
|
||||||
|
@ -135,7 +135,7 @@ class GTSAM_EXPORT Null : public Base {
|
||||||
Null(const ReweightScheme reweight = Block) : Base(reweight) {}
|
Null(const ReweightScheme reweight = Block) : Base(reweight) {}
|
||||||
~Null() {}
|
~Null() {}
|
||||||
double weight(double /*error*/) const { return 1.0; }
|
double weight(double /*error*/) const { return 1.0; }
|
||||||
double residual(double error) const { return error; }
|
double loss(double distance) const { return 0.5 * distance * distance; }
|
||||||
void print(const std::string &s) const;
|
void print(const std::string &s) const;
|
||||||
bool equals(const Base & /*expected*/, double /*tol*/) const { return true; }
|
bool equals(const Base & /*expected*/, double /*tol*/) const { return true; }
|
||||||
static shared_ptr Create();
|
static shared_ptr Create();
|
||||||
|
|
Loading…
Reference in New Issue