These are built-in loss functions.

RSAVS_L2(x, param)

RSAVS_L1(x, param)

RSAVS_Huber(x, param, derivative = FALSE)

Arguments

x

input numeric vector

param

parameters needed for the function, takes the form of numeric vector. Unused for L1 and L2.

derivative

logical, whether the return is the loss value or the derivative.

Value

Loss(or derivative) value at x.

Examples

RSAVS_L2(1 : 10)
#>  [1]   1   4   9  16  25  36  49  64  81 100
RSAVS_L1(1 : 10)
#>  [1]  1  2  3  4  5  6  7  8  9 10
RSAVS_Huber(seq(from = -3, to = 3, by = 0.1), param = 1.345)
#>  [1] 3.1304875 2.9959875 2.8614875 2.7269875 2.5924875 2.4579875 2.3234875
#>  [8] 2.1889875 2.0544875 1.9199875 1.7854875 1.6509875 1.5164875 1.3819875
#> [15] 1.2474875 1.1129875 0.9784875 0.8450000 0.7200000 0.6050000 0.5000000
#> [22] 0.4050000 0.3200000 0.2450000 0.1800000 0.1250000 0.0800000 0.0450000
#> [29] 0.0200000 0.0050000 0.0000000 0.0050000 0.0200000 0.0450000 0.0800000
#> [36] 0.1250000 0.1800000 0.2450000 0.3200000 0.4050000 0.5000000 0.6050000
#> [43] 0.7200000 0.8450000 0.9784875 1.1129875 1.2474875 1.3819875 1.5164875
#> [50] 1.6509875 1.7854875 1.9199875 2.0544875 2.1889875 2.3234875 2.4579875
#> [57] 2.5924875 2.7269875 2.8614875 2.9959875 3.1304875
RSAVS_Huber(seq(from = -3, to = 3, by = 0.1), param = 1.345, derivative = TRUE)
#>  [1] -1.345 -1.345 -1.345 -1.345 -1.345 -1.345 -1.345 -1.345 -1.345 -1.345
#> [11] -1.345 -1.345 -1.345 -1.345 -1.345 -1.345 -1.345 -1.300 -1.200 -1.100
#> [21] -1.000 -0.900 -0.800 -0.700 -0.600 -0.500 -0.400 -0.300 -0.200 -0.100
#> [31]  0.000  0.100  0.200  0.300  0.400  0.500  0.600  0.700  0.800  0.900
#> [41]  1.000  1.100  1.200  1.300  1.345  1.345  1.345  1.345  1.345  1.345
#> [51]  1.345  1.345  1.345  1.345  1.345  1.345  1.345  1.345  1.345  1.345
#> [61]  1.345