View source: R/evaluate_residuals.R
evaluate_residuals | R Documentation |
Calculates a large set of error metrics from regression residuals.
Note: In most cases you should use evaluate()
instead.
It works in magrittr
pipes (e.g. %>%
) and with
dplyr::group_by()
.
evaluate_residuals()
is more lightweight and may be preferred in
programming when you don't need the extra stuff
in evaluate()
.
evaluate_residuals(data, target_col, prediction_col, metrics = list())
data |
|
target_col |
Name of the column with the true values in |
prediction_col |
Name of column with the predicted values in |
metrics |
E.g. You can enable/disable all metrics at once by including
The Also accepts the string |
The metric formulas are listed in 'The Available Metrics' vignette.
tibble
data.frame
with the calculated metrics.
The following metrics are available (see `metrics`
):
Metric | Name | Default |
Mean Absolute Error | "MAE" | Enabled |
Root Mean Square Error | "RMSE" | Enabled |
Normalized RMSE (by target range) | "NRMSE(RNG)" | Disabled |
Normalized RMSE (by target IQR) | "NRMSE(IQR)" | Enabled |
Normalized RMSE (by target STD) | "NRMSE(STD)" | Disabled |
Normalized RMSE (by target mean) | "NRMSE(AVG)" | Disabled |
Relative Squared Error | "RSE" | Disabled |
Root Relative Squared Error | "RRSE" | Enabled |
Relative Absolute Error | "RAE" | Enabled |
Root Mean Squared Log Error | "RMSLE" | Enabled |
Mean Absolute Log Error | "MALE" | Disabled |
Mean Absolute Percentage Error | "MAPE" | Disabled |
Mean Squared Error | "MSE" | Disabled |
Total Absolute Error | "TAE" | Disabled |
Total Squared Error | "TSE" | Disabled |
The Name column refers to the name used in the package.
This is the name in the output and when enabling/disabling in `metrics`
.
Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk
Other evaluation functions:
binomial_metrics()
,
confusion_matrix()
,
evaluate()
,
gaussian_metrics()
,
multinomial_metrics()
# Attach packages
library(cvms)
data <- data.frame(
"targets" = rnorm(100, 14.7, 3.6),
"predictions" = rnorm(100, 13.2, 4.6)
)
evaluate_residuals(
data = data,
target_col = "targets",
prediction_col = "predictions"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.