Skip to contents

Compute the mean squared error of the predictions of a model. For binary classification this corresponds to the Brier-Score.

Usage

EvaluatorMSE(.prediction, .data, .target)

Arguments

.prediction

A data.frame object containing the predictions of a model. The columns should contain the predictions and the true values. If only the predictions are handed over, the true values of the target variable have to be handed over in the .data and the name of the target variable in the .target argument.

.data

Optional argument, which has to be provided if only the predictions are handed over in .prediction, .data has to be a data.frame which contains the true values.

.target

If only the predictions are handed over in .prediction, .target has to be handed over as a character. of length 1 being the name of the target variable.

Value

The mean squared error of the predictions.

Examples

x <- data.frame(var1 = c(1, 1, 1, 1, 0), target = c(1, 2, 3, 4, 5))
predictions <- c(3)
EvaluatorMSE(predictions, x, "target")
#> [1] 2
predictions <- data.frame(prediction = c(1.3, 2.5, 2.6, 3.5, 4.5), truth = c(1, 2, 3, 4, 5))
EvaluatorMSE(predictions)
#> [1] 0.2