Description Usage Arguments Value Examples
View source: R/calc_confusion_matrix.R
Calculates the confusion matrix of observed and predicted classes, after
converting them into factors first (not currently done by
conf_mat{yardstick}
).
1 | calc_confusion_matrix(x, target_col_name, target_pred_col_name, ...)
|
x |
A data frame with two columns: the column with the actual classes; and the column with the predicted classes. Any other columns will be ignored. |
target_col_name |
A string with the column name of the target variable. |
target_pred_col_name |
A string with the column name of the predictions for the target variable. |
... |
Further arguments passed from other methods. |
An object with class conf_mat()
(see conf_mat{yardstick}
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | library(experienceAnalysis)
mtcars %>%
dplyr::mutate(carb_pred = sample(carb, size = nrow(.))) %>% # Mock predictions column
calc_accuracy_per_class(
target_col_name = "carb",
target_pred_col_name = "carb_pred"
)
# Custom column names
mtcars %>%
dplyr::mutate(carb_pred = sample(carb, size = nrow(.))) %>% # Mock predictions column
calc_confusion_matrix(
target_col_name = "carb",
target_pred_col_name = "carb_pred"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.