Learn R Programming

opera (version 1.2.0)

check_loss: Function to check validy of provided loss function

Description

Function to check validy of provided loss function

Usage

check_loss(
  loss.type,
  loss.gradient,
  Y = NULL,
  model = NULL,
  use_cpp = getOption("opera_use_cpp", default = FALSE)
)

Arguments

loss.type

character, list or function.

character

Name of the loss to be applied ('square', 'absolute', 'percentage', or 'pinball');

list

When using pinball loss: list with field name equal to 'pinball' and field tau equal to the required quantile in [0,1];

function

A custom loss as a function of two parameters.

loss.gradient

boolean, function.

boolean

If TRUE, the aggregation rule will not be directly applied to the loss function at hand, but to a gradient version of it. The aggregation rule is then similar to gradient descent aggregation rule.

function

If loss.type is a function, the derivative should be provided to be used (it is not automatically computed).

Y

numeric (NULL). (Optional) Target values (to perform some checks).

model

character (NULL). (Optional) Model used (to perform some checks).

use_cpp

boolean. Whether or not to use cpp function to increase perf.

Value

loss.type