mlh_reshape | R Documentation |
Machine learning helper function to reshape a matrix of predicted probabilities to classes.
mlh_reshape(object)
object |
A matrix with predicted probabilities for several classes. Each row must sum up to 1. |
Returns a vector of type factor of the same length as rows in object, representing the class with the highest probability for each observation in object.
set.seed(123)
class_0 <- rbeta(100, 2, 4)
class_1 <- (1 - class_0) * 0.4
class_2 <- (1 - class_0) * 0.6
dataset <- cbind("0" = class_0, "1" = class_1, "2" = class_2)
mlh_reshape(dataset)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.