Evaluate Predictions using the Mean Absolute Error
Source:R/evaluation_EvaluatorMAE_MSE.R
EvaluatorMAE.RdCompute the mean absolute error of the predictions of a model.
Arguments
- .prediction
A
data.frameobject 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.dataargument and the name of the variable has to be handed over in.target.- .data
Optional argument, which has to be provided if only the predictions are handed over in
.prediction,.datahas to be adata.framewhich contains the true values.- .target
If only the predictions are handed over in
.prediction,.targethas to be set and is the name of the target variable that was predicted, handed over as acharacterof length 1.
See also
For further Evaluators: EvaluatorMSE(), EvaluatorAIC(), EvaluatorBIC(), EvaluatorAccuracy(),
EvaluatorAUC()
Examples
x <- data.frame(var1 = c(1, 1, 1, 1, 0), target = c(1, 2, 3, 4, 5))
predictions <- c(3)
EvaluatorMAE(predictions, x, "target")
#> [1] 1.2
predictions <- data.frame(prediction = c(1.3, 2.5, 2.6, 3.5, 4.5), truth = c(1, 2, 3, 4, 5))
EvaluatorMAE(predictions)
#> [1] 0.44