Description Super classes Methods Author(s) Examples
R6 class representing a softmax regression model.
R6 class representing a softmax regression model.
modello::module
-> modello::module.lm
-> module.softmax
new()
The initialisation method sets the weights (W), the bais (B) matrices, the objective function (obj), as well as the name of the module. The calculation performed is the following ans = softmax(W.op(X) + B)
module.softmax$new(tx, nin, nout, b = TRUE)
tx
if TRUE it traspose the input matrix
nin
number of column of the input matrix
nout
number of outputs
b
if TRUE the intercept term is included
Returns the total number of parameters
op()
Performs: ans = sigmoid(W.op(X) + B)
module.softmax$op(X)
X
input matrix, reference object of class 'number'
Returns a reference object of class 'number'
\donttest{ modello.init(10, 10, 10, 10) X = number(matrix(rnorm(12), 6), dx=FALSE) mdl = module.softmax$new(1, 2, 3, b=FALSE) print(X$v) Yh = mdl$op(X) print(Yh) print(Yh$v) modello.close() }
clone()
The objects of this class are cloneable with this method.
module.softmax$clone(deep = FALSE)
deep
Whether to make a deep clone.
Filippo Monari
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## ------------------------------------------------
## Method `module.softmax$op`
## ------------------------------------------------
modello.init(10, 10, 10, 10)
X = number(matrix(rnorm(12), 6), dx=FALSE)
mdl = module.softmax$new(1, 2, 3, b=FALSE)
print(X$v)
Yh = mdl$op(X)
print(Yh)
print(Yh$v)
modello.close()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.