View source: R/model_metrics_curves.R
model_metrics_curves | R Documentation |
This function uses the tibble that can be generated with the package function [get_threshold_data()] and plots the values of selected metrics in dependency of the threshold. This can be inspiring to evaluate the selection of a threshold for different learning aims. A selected threshold value can be provided to set a vertical mark in the plot
model_metrics_curves(df, metrics, plot_title, threshold = NA)
df |
- The tibble that can be generated with the package function [get_threshold_data()] |
metrics |
- A character vectore of metrics that will be plotted. Note, that some of the returned metrics mean principally the same: Recall = Sensitivity, Precision = PPV, BalancedAccuracy = roc_auc. The available metrics are: "Sensitivity", "Specificity", "Pos Pred Value", "Neg Pred Value", "Precision", "Recall", "F1", "Prevalence", "Detection Rate", "Detection Prevalence", "Balanced Accuracy", "TP", "FN", "FP", "TN", "P", "N", "N_samples", "pr_baseline", "P_pred", "N_pred", "fpr", "tpr", "tnr", "fnr", "roc_auc" |
plot_title |
- A title for your plot |
threshold |
- The threshold that should be marked with a vertical dashed line. Optional. |
A ggplot2 object is returned which can be extended by further ggplot functions, be showed and saved. NULL is returned, if none of the requested metrics is available
y_true <- sample(c(0,1), replace = TRUE, size = 1000)
y_predicted <- runif(1000)
data <- get_threshold_data(truth = y_true, prediction = y_predicted)
plot <- model_metrics_curves(df = data,
metrics = c("Sensitivity", "F1", "Balanced Accuracy"),
plot_title = "SENS, F1 and balanced Accuracy across classification threshold",
threshold = 0.5)
show(plot)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.