softmax: Calculate the softmax of a vector or matrix of values

View source: R/utilities.R

softmaxR Documentation

Calculate the softmax of a vector or matrix of values

Description

Calculate the softmax (normalized exponential) of a vector of values or a set of vectors stacked rowwise.

Usage

softmax(x)

Arguments

x

numeric vector or matrix

Value

The softmax of x.

Examples

  dat <- matrix(runif(100, -1, 1), 25, 4)
  softmax(dat)
  softmax(dat[,1])


LDATS documentation built on Sept. 19, 2023, 5:08 p.m.