rmsle: Root Mean Square Logarithmic Error

Description Usage Arguments Details Examples

View source: R/rmsle.R

Description

Calculate Root-Mean-Square-Logarithmic Error (Deviation)

For the ith sample, Squared Logarithmic Error is calculated as SLE = (log(prediction + alpha) - log(actual + alpha))^2. RMSLE is then sqrt(mean(squared logarithmic errors)). alpha (1 by default) can be used to prevent taking log(0) for data that contains non positive values

Usage

1
rmsle(preds = NULL, actuals = NULL, weights = 1, na.rm = FALSE, alpha = 1)

Arguments

preds

A vector of prediction values in [0, 1]

actuals

A vector of actuals values in 0, 1, or FALSE, TRUE

weights

Optional vectors of weights

na.rm

Should (prediction, actual) pairs with at least one NA value be ignored?

alpha

(defualt = 1) See the formula details. Primary purpose is to prevent taking log(0)

Details

Calculate Root-Mean-Square-Logarithmic Error (Deviation)

Examples

1
2
3
preds <- c(1.0, 2.0, 9.5)
actuals <- c(0.9, 2.1, 10.0)
rmsle(preds, actuals)

ben519/mltools documentation built on Sept. 22, 2021, 4:30 p.m.