Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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)

Arguments

x

a numeric matrix.

gap

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

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.

See Also

Examples

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

mda

Mixture and Flexible Discriminant Analysis

v0.5-2
GPL-2
Authors
S original by Trevor Hastie & Robert Tibshirani. Original R port by Friedrich Leisch, Kurt Hornik and Brian D. Ripley. Balasubramanian Narasimhan has contributed to the upgrading of the code.
Initial release
2020-06-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.