Skip to content

Instantly share code, notes, and snippets.

@cseidman

cseidman/perfmeasures.R Secret

Created Jan 24, 2018
Embed
What would you like to do?
calculateperfmeasures.R
# 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
You can’t perform that action at this time.