calculateperfmeasures.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Common classification performance measures | |
# Set the variables | |
tN <- cMx[1,1] # True negative | |
tP <- cMx[2,2] # True positive | |
fP <- cMx[2,1] # False positive | |
fN <- cMx[1,2] # False negative | |
pM.Accuracy <- round((tP + tN)/(tP + fP + tN + fN),2) | |
pM.Precision <- round(tP/(tP + fP),2) | |
pM.Recall <- round(tP/(tP + fN),2) | |
pM.Specificity <- round(tN/(tN + fP),2) | |
f1 <- round((2 * pM.Precision * pM.Recall)/(pM.Precision + pM.Recall),2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment