Skip to content

Instantly share code, notes, and snippets.

@joseph-rickert
Last active March 11, 2016 22:25
Show Gist options
  • Save joseph-rickert/e49f097e43718aaee0ae to your computer and use it in GitHub Desktop.
Save joseph-rickert/e49f097e43718aaee0ae to your computer and use it in GitHub Desktop.
set.seed(0)
actual = c('a','b','c')[runif(100, 1,4)] # actual labels
predicted = actual # predicted labels
predicted[runif(30,1,100)] = actual[runif(30,1,100)] # introduce incorrect predictions
cm = as.matrix(table(Actual = actual, Predicted = predicted)) # create the confusion matrix
cm
## Predicted
## Actual a b c
## a 24 2 1
## b 3 30 4
## c 0 5 31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment