prob2categorical | R Documentation |
Convert probabilities to categorical (factor)
prob2categorical(x, levels, binclasspos = NULL)
x |
Numeric vector: Probabilities |
levels |
Character vector: Class labels |
binclasspos |
Integer: Index of the positive class for binary classification |
Factor
EDG
## Not run:
# Binary classification where "A" is the positive class, so .1 => B, .5 & .9 => A
prob2categorical(c(.1, .5, .9), c("A", "B"), 1)
# Binary classification where "B" is the positive class, so .1 => A, .5 & .9 => B
prob2categorical(c(.1, .5, .9), c("A", "B"), 2)
# Multi-class classification
prob <- matrix(c(.1, .3, .6, .05, .6, .35, .4, .3, .3), nrow = 3, byrow = TRUE)
prob2categorical(prob, c("A", "B", "C"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.