mlh_reshape {kdry} | R Documentation |
mlh_reshape
Description
Machine learning helper function to reshape a matrix of predicted probabilities to classes.
Usage
mlh_reshape(object)
Arguments
object |
A matrix with predicted probabilities for several classes. Each row must sum up to 1. |
Value
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.
Examples
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)
[Package kdry version 0.0.2 Index]