Description Usage Arguments Value Author(s) Examples
Calculates the Softmax function
sofmax = \frac{exp(\bf x)}{∑{exp(\bf x)}}
1 2 3 4 5 6 7 8 9 10 |
x |
a 'numeric' or a reference object of class 'number' |
k |
dimension index. Currently constained to be <= 2 |
Returns a 'numeric' or reference object of class 'number'
Filippo Monari
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | modello.init(10, 10, 10, 10)
## For modello_number matrices
x = number(matrix(rnorm(9), 3, 3))
y1 = softmax(x)
print(y1)
print(y1$v)
y2 = softmax(x, 1)
print(y2)
print(y2$v)
y3 = softmax(x, 2)
print(y3)
print(y3$v)
modello.close()
## For numerics
x = rnorm(5)
y = softmax(x)
print(y)
## For matrices
x = matrix(rnorm(9), 3, 3)
y1 = softmax(x)
print(y1)
y2 = softmax(x, 1)
print(y2)
y3 = softmax(x, 2)
print(y3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.