error: Error Calculation

Description Usage Arguments Details Value Examples

Description

Calculate the mean absolute error (MAE), mean square error (MSE), root mean square error (RMSE) and for matrices also the Frobenius norm (identical to RMSE).

Usage

1
2
3
4
MSE(true, predicted, na.rm = TRUE)
RMSE(true, predicted, na.rm = TRUE)
MAE(true, predicted, na.rm = TRUE)
frobenius(true, predicted, na.rm = TRUE)

Arguments

true

true values.

predicted

predicted values

na.rm

ignore missing values.

Details

Frobenius norm requires matrices.

Value

The error value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
true <- rnorm(10)
predicted <- rnorm(10)

MAE(true, predicted)
MSE(true, predicted)
RMSE(true, predicted)

true <- matrix(rnorm(9), nrow = 3)
predicted <- matrix(rnorm(9), nrow = 3)

frobenius(true, predicted)

Example output

Loading required package: Matrix
Loading required package: arules

Attaching package: 'arules'

The following objects are masked from 'package:base':

    abbreviate, write

Loading required package: proxy

Attaching package: 'proxy'

The following object is masked from 'package:Matrix':

    as.matrix

The following objects are masked from 'package:stats':

    as.dist, dist

The following object is masked from 'package:base':

    as.matrix

Loading required package: registry
[1] 1.359388
[1] 2.699829
[1] 1.643116
[1] 1.338516

recommenderlab documentation built on Feb. 27, 2021, 1:06 a.m.