module.logistic: R6 class representing a logistic regression model.

Description Super classes Methods Author(s) Examples

Description

R6 class representing a logistic regression model.

R6 class representing a logistic regression model.

Super classes

modello::module -> modello::module.lm -> module.logistic

Methods

Public methods

Inherited methods

Method 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 = sigmoid(W.op(X) + B)

Usage
module.logistic$new(tx, nin, b = TRUE)
Arguments
tx

if TRUE it traspose the input matrix

nin

number of column of the input matrix

b

if TRUE the intercept term is included

Returns

Returns the total number of parameters


Method op()

Performs: ans = sigmoid(W.op(X) + B)

Usage
module.logistic$op(X)
Arguments
X

input matrix, reference object of class 'number'

Returns

Returns a reference object of class 'number'

Examples
\donttest{
modello.init(10, 10, 10, 10)
X = number(as.matrix(rnorm(10)), dx=FALSE)
mdl = module.logistic$new(1, 1, b=FALSE)
print(X$v)
Yh = mdl$op(X)
print(Yh)
print(Yh$v)
modello.close()
}

Method clone()

The objects of this class are cloneable with this method.

Usage
module.logistic$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

Filippo Monari

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## ------------------------------------------------
## Method `module.logistic$op`
## ------------------------------------------------


modello.init(10, 10, 10, 10)
X = number(as.matrix(rnorm(10)), dx=FALSE)
mdl = module.logistic$new(1, 1, b=FALSE)
print(X$v)
Yh = mdl$op(X)
print(Yh)
print(Yh$v)
modello.close()

modello documentation built on Feb. 2, 2021, 9:06 a.m.