classifierEval | R Documentation |
Evaluate binary classifier's performance with respect to user-selected metric (accuracy, auc score, precision, recall, f1 score) for binary phenotype.
classifierEval(
obs,
pred,
EvalMethod = "accuracy",
BinarizeThreshold = 0.5,
print_score = TRUE
)
obs |
Observed phenotype, vector consists of 0, 1. |
pred |
Predicted probability of the phenotype, vector consists of any value between 0 and 1 |
EvalMethod |
Binary classifier evaluation method, should be one of the following: 'accuracy' (default), 'auc', 'precision', 'recall', and 'f1'. |
BinarizeThreshold |
Cutoff threshold to binarize the predicted probability, default is set to 0.5. |
print_score |
Whether to print out the evaluation score, default is set to |
An evaluation score corresponding to the selected metric.
# simulate observed binary phenotype
obs <- rbinom(100,1,0.5)
# simulate predicted probability
pred <- runif(100, 0,1)
# calculate the score
pred_score <- classifierEval(obs, pred, EvalMethod = 'f1', print_score = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.