evaluation_metrics: Calculate Evaluation Metrics

Description Usage Arguments Value See Also Examples

Description

This function calculates evaluation metrics for classifications / predictions and their corresponding observed values. The function calculates 9 different classification metrics; Accuaracy, True Poistive Rate, False Positive Rate, True Negative Rate, False Negative Rate, Positive Prediction Rate, Negative Predicition Rate and F1 Score. The function calculates 7 different prediction metrics; Sum Squared Error, Sum Absolute Error, Mean Sum Squared Error, Mean Absolute Error, Root Mean Squared Error, Root Mean Absolute Error and R Squared The metrics are outputted as a data frame.

Usage

1
2
evaluation_metrics(y_obs, y_pred, type = c("classification", "prediction"),
  plots = FALSE, file_name = NULL, directory = NULL)

Arguments

y_obs

The true observations.

y_pred

The model predictions.

plots

Logical, indeicating whether to return appropriate plots.

file_name

A character object indicating the file name when saving the data frame. The default is NULL. The name must include the .csv suffixs.

directory

A character object specifying the directory where the data frame is to be saved as a .csv file.

Value

Outputs the metrics as a data frame

See Also

ensemble_mars, ensemble_glmnet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#-- Classification Example --#

y_obs = as.factor(c(1,1,0,1,0,1,1,1,0,0,1,1,0,1,0,0,0,1,0,0,0))
y_pred = as.factor(c(1,1,0,1,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,0,1))
evaluation_metrics(y_obs, y_pred, type = 'classification')

y_obs = y_pred
evaluation_metrics(y_obs, y_pred, type = 'classification')

#-- Prediction Example --#

y_obs = rnorm(n = 150, sd = 10, mean = 75)
y_pred = rnorm(n = 150, sd = 25, mean = 75)
evaluation_metrics(y_obs, y_pred, type = 'prediction', plots = TRUE)

oislen/BuenaVista documentation built on May 16, 2019, 8:12 p.m.