Learn R Programming

LDATS (version 0.3.0)

softmax: 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)

Value

The softmax of x.

Arguments

x

numeric vector or matrix

Examples

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

Run the code above in your browser using DataLab