Enum ceres_solver::loss::LossFunction
source · pub enum LossFunction {
Custom(CustomLossFunction),
Stock(StockLossFunction),
}Expand description
Loss function for ResidualBlock and CurveFitProblem1D, it is a transformation of the squared residuals which is generally used to make the solver less sensitive to outliers. This enum has two flavours: user specified function and Ceres stock function.
Variants§
Custom(CustomLossFunction)
User-specified loss function.
Stock(StockLossFunction)
One of the loss functions specified by Ceres, see Ceres Solver docs for details.
Implementations§
source§impl LossFunction
impl LossFunction
sourcepub fn custom(func: impl Into<LossFunctionType>) -> Self
pub fn custom(func: impl Into<LossFunctionType>) -> Self
Create a LossFunction to handle a custom loss function.
Arguments
- func - a boxed function which accepts two arguments: non-negative squared residual, and an array of 0) loss function value, 1) its first, and 2) its second derivatives. See details at http://ceres-solver.org/nnls_modeling.html#_CPPv4N5ceres12LossFunctionE.
sourcepub fn huber(a: f64) -> Self
pub fn huber(a: f64) -> Self
Huber loss function, see details at http://ceres-solver.org/nnls_modeling.html#_CPPv4N5ceres9HuberLossE.
sourcepub fn soft_l1(a: f64) -> Self
pub fn soft_l1(a: f64) -> Self
Soft L1 loss function, see details at http://ceres-solver.org/nnls_modeling.html#_CPPv4N5ceres12SoftLOneLossE.
sourcepub fn cauchy(a: f64) -> Self
pub fn cauchy(a: f64) -> Self
log(1+s) loss function, see details at http://ceres-solver.org/nnls_modeling.html#_CPPv4N5ceres10CauchyLossE.
sourcepub fn arctan(a: f64) -> Self
pub fn arctan(a: f64) -> Self
Arctangent loss function, see details at http://ceres-solver.org/nnls_modeling.html#_CPPv4N5ceres10ArctanLossE.
sourcepub fn tolerant_loss(a: f64, b: f64) -> Self
pub fn tolerant_loss(a: f64, b: f64) -> Self
Tolerant loss function, see details at http://ceres-solver.org/nnls_modeling.html#_CPPv4N5ceres12TolerantLossE.