softmax | R Documentation |
softmax
returns the value of the softmax function
softmaxinv
returns the value of the inverse-softmax function
softmax(eta, lambda = 1)
softmaxinv(p, lambda = 1)
eta |
A numeric vector input |
lambda |
Tuning parameter (a single positive value) |
p |
A probability vector (i.e., numeric vector of non-negative values that sum to one) |
The softmax function is a bijective function that maps a real vector with length m-1
to a probability vector
with length m
with all non-zero probabilities. The present functions define the softmax function and its inverse, both with a tuning
parameter.
The current functions define the softmax as:
\Large P(\eta_i) = \frac{e^{\lambda \eta_i}}{1+ \sum_{j=1}^m e^{\lambda \eta_j}}
Code adapted from the utilities package
Value of the softmax function or its inverse
softmax(5:7)
softmaxinv(softmax(5:7))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.