Skip to content

Instantly share code, notes, and snippets.

@toyeiei

toyeiei/.R

Last active Jan 28, 2019
Embed
What would you like to do?
bayes application - cancer detection
# create confusion matrix
result <- matrix(c(99,1,495,9405), ncol=2, byrow=T)
colnames(result) <- c("Positive", "Negative")
rownames(result) <- c("Cancer", "No Cancer")
# see the table
result
sum(result) # n=10000
# overall accuracy of the medical test
(99 + 9405) / 10000 # 0.9504
# p(cancer|+) = true positive / all positives
99 / (99 + 495) # 0.1667
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment