mlh_reshape: mlh_reshape

View source: R/mlh_reshape.R

mlh_reshapeR 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)

kdry documentation built on July 4, 2024, 9:07 a.m.

Related to mlh_reshape in kdry...