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

Format

S4 object.

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)

Arguments

offset [numeric(1)]

Numerical value which can be used to set a custom offset. If so, 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 is 1.

Examples

# Create new loss object: huber_loss = LossHuber$new() huber_loss
#> #> LossHuber Loss: #> #> Loss function: 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 #> #>