LossHuber: Huber loss for regression tasks.

LossHuberR Documentation

Huber loss for regression tasks.

Description

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

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).

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)

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


schalkdaniel/compboost documentation built on April 15, 2023, 9:03 p.m.