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

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.

delta

(numeric(1))
Numerical value greater than 0 to specify the interval around 0 for the quadratic error measuring (default delta = 1).

## Details

Loss Function: $$L(y, f(x)) = 0.5(y - f(x))^2 \ \ \mathrm{if} \ \ |y - f(x)| < d$$ $$L(y, f(x)) = d|y - f(x)| - 0.5d^2 \ \ \mathrm{otherwise}$$ Gradient: $$\frac{\delta}{\delta f(x)}\ L(y, f(x)) = f(x) - y \ \ \mathrm{if} \ \ |y - f(x)| < d$$ $$\frac{\delta}{\delta f(x)}\ L(y, f(x)) = -d\mathrm{sign}(y - f(x)) \ \ \mathrm{otherwise}$$

## Usage


LossHuber$new() LossHuber$new(delta)
LossHuber$new(offset, delta) ## 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:
huber_loss = LossHuber\$new()
huber_loss
#> LossHuber: L(y,x) = if (y - f(x) < d) { 0.5(y - f(x))^2 } else { d|y - f(x)| - 0.5d^2 }
#>
#>   with delta d = 1