Skip to contents

This loss can be used for regression with \(y \in \mathrm{R}\).

Format

S4 object.

Arguments

offset

(numeric(1) | matrix())
Numerical value or matrix to set a custom offset. If used, this value is returned instead of the loss optimal initialization.

Details

Loss Function: $$ L(y, f(x)) = | y - f(x)| $$ Gradient: $$ \frac{\delta}{\delta f(x)}\ L(y, f(x)) = -\mathrm{sign}(y - f(x)) $$ Initialization: $$ \hat{f}^{[0]}(x) = \mathrm{arg~min}_{c\in R}\ \frac{1}{n}\sum\limits_{i=1}^n L(y^{(i)}, c) = \mathrm{median}(y) $$

Usage


LossAbsolute$new()
LossAbsolute$new(offset)

Inherited methods from Loss

  • $loss(): matrix(), matrix() -> matrix()

  • $gradient(): matrix(), matrix() -> matrix()

  • $constInit(): matrix() -> matrix()

  • $calculatePseudoResiduals(): matrix(), matrix() -> matrix()

  • $getLossType(): () -> character(1)

Examples


# Create new loss object:
absolute_loss = LossAbsolute$new()
absolute_loss
#> LossAbsolute: L(y,x) = |y - f(x)|
#>