Description Usage Arguments Value Author(s) Examples
The function takes the base dataframe with observed/actual and predicted columns. The actual/predicted class preferably should be binary and if not, it will be considered as event vs rest. It computes the performance measures like accuracy, precision, recall, sensitivity, specificity and f1 score.
1 | fn_conf_mat(base, observed_col, predicted_col, event)
|
base |
input dataframe |
observed_col |
column / field name of the observed event |
predicted_col |
column / field name of the predicted event |
event |
the event class, to be passed as string |
An object of class "fn_conf_mat" is a list containing the following components:
confusion_mat |
confusion matrix as a table |
accuracy |
accuracy measure |
precision |
precision measure |
recall |
recall measure |
sensitivity |
sensitivity measure |
specificity |
specificity measure |
f1_score |
F1 score |
Arya Poddar <aryapoddar290990@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data <- iris
data$Species <- as.character(data$Species)
suppressWarnings(RNGversion('3.5.0'))
set.seed(11)
data$Y <- sample(0:1,size=nrow(data),replace=TRUE)
data$Y_pred <- sample(0:1,size=nrow(data),replace=TRUE)
fn_conf_mat_list <- fn_conf_mat(base = data,observed_col = "Y",predicted_col = "Y_pred",event = 1)
fn_conf_mat_list$confusion_mat
fn_conf_mat_list$accuracy
fn_conf_mat_list$precision
fn_conf_mat_list$recall
fn_conf_mat_list$sensitivity
fn_conf_mat_list$specificity
fn_conf_mat_list$f1_score
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.