Learn R Programming

mda (version 0.5-4)

softmax: Find the Maximum in Each Row of a Matrix

Description

Find the maximum in each row of a matrix.

Usage

softmax(x, gap = FALSE)

Value

A factor with levels the column labels of x and values the columns corresponding to the maximum column. If gap = TRUE a list is returned, the second component of which is the difference between the largest and next largest column of x.

Arguments

x

a numeric matrix.

gap

if TRUE, the difference between the largest and next largest column is returned.

See Also

predict.fda, confusion, fda mda

Examples

Run this code
data(iris)
irisfit <- fda(Species ~ ., data = iris)
posteriors <- predict(irisfit, type = "post")
confusion(softmax(posteriors), iris[, "Species"])

Run the code above in your browser using DataLab