powered by
Calculates Mean Absolute Error handling non-finite values.
safe_mae(actual, predicted)
A single numeric value for MAE, or NA if calculation not possible.
Numeric vector of actual values.
Numeric vector of predicted values.
actual <- c(1, 2, 3, 4, 5) predicted <- c(1.1, 2.2, 2.9, 4.1, 5.2) safe_mae(actual, predicted)
Run the code above in your browser using DataLab