Learn R Programming

modello (version 0.1.1)

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

Description

R6 class representing a logistic regression model.

R6 class representing a logistic regression model.

Arguments

Super classes

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

Methods

Public 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.

Examples

Run this code
# NOT RUN {
## ------------------------------------------------
## Method `module.logistic$op`
## ------------------------------------------------

# }
# NOT RUN {
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()
# }

Run the code above in your browser using DataLab