softmax | R Documentation |
Calculates the softmax function for mapping a set of real values to a probability distribution.
The maxima/um receives quite a bit of weight via softmax: Given the values [4, 4, 4, 5]
, softmax
returns a probability of .475 for the final element and 0.175 for each of the first three.
softmax(x, digits = NULL)
x |
A double or integer vector. |
digits |
The number of digits to round the output probabilities to. |
A length-one vector.
x <- c(3.5, 4.0, 6.5)
softmax(x)
softmax(x, digits = 4)
x <- c(NA, 3.5, 4.0, 6.5)
softmax(x, 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.