powered by
Softmax for a vector x is defined as
softmax(x)dsoftmax(x)
dsoftmax(x)
softmax returns the softmax of x; rowwise if x is a matrix.
softmax
x
dsoftmax returns the Jacobi-matrix of softmax(x) at x. x must be a vector.
dsoftmax
softmax(x)
A numeric vector or matrix
\(s_i = \exp(x_i) / \sum_k \exp(x_k)\)
It satisfies sum(s) == 1.0 and can be used to smoothly enforce a sum constraint.
sum(s) == 1.0
softmax(c(5, 5)) softmax(diag(nrow = 5, ncol = 6))
Run the code above in your browser using DataLab