inv_smax | R Documentation |
The inverse softmax function: take a logarithm and center.
inv_smax(mu, g = NULL)
mu |
a vector of the probablities.
Must be the same length as |
g |
a vector giving the group indices. If |
This is the inverse of the softmax function. Given
vector \mu
for a single group, finds vector
\eta
such that
\eta_i = \log{\mu_i} + c,
where c
is chosen such that the \eta
sum
to zero:
c = \frac{-1}{n} \sum_i \log{\mu_i}.
the centered log probabilities.
This function can deal with overflow in a semi-coherent way.
Steven E. Pav shabbychef@gmail.com
smax
# we can deal with large values:
set.seed(2345)
eta <- rnorm(12,sd=1000)
mu <- smax(eta)
eta0 <- inv_smax(mu)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.