print.elmNN: Print a summary of the attributes of a trained neural network

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/print.elmNN.R

Description

Print the attributes of a elmNN object.

Usage

1
2
## S3 method for class 'elmNN'
print(x, ...)

Arguments

x

an object of class elmNN.

...

not used.

Value

Furthermore a list of the printed attributes.

nhid

number of hidden neurons selected

actfun

activation function used

inpweight

head of the matrix of input weights ( randomly calculated )

biashid

head of the vector of hidden layer bias ( randomly calculated )

outweight

head of the matrix of output weights ( calculated by the algorithm )

fitted(x)

head of the vector with the output prediction of the training set

Author(s)

Alberto Gosso

References

see elmNN-package documentation.

See Also

elmtrain.default,elmtrain.formula,predict.elmNN,elmNN-package

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
set.seed(1234)
Var1 <- runif(50, 0, 100) 
sqrt.data <- data.frame(Var1, Sqrt=sqrt(Var1))
model <- elmtrain.formula(Sqrt~Var1, data=sqrt.data, nhid=10, actfun="sig")
print(model)

## The function is currently defined as
function (x, ...) 
{
    cat("Call:\n")
    cat(paste(x$call, "\n"))
    cat("Number of hidden neurons:\n")
    cat(paste(x$nhid, "\n"))
    cat("Activation function:\n")
    cat(paste(x$actfun, "\n"))
    cat("Input arc weights:\n")
    cat(paste(head(x$inpweight), "...\n"))
    cat("Bias of hidden neurons:\n")
    cat(paste(head(x$biashid), "...\n"))
    cat("Output arc weights:\n")
    cat(paste(head(x$outweight), "...\n"))
    cat("Predictions on training set:\n")
    cat(paste(head(fitted(x)), "...\n"))
  }

Example output

Loading required package: MASS
Call:
elmtrain.formula 
 Sqrt ~ Var1 
 sqrt.data 
 10 
 sig 
Number of hidden neurons:
10 
Activation function:
sig 
Input arc weights:
-0.852440239861608 ...
 -0.380626796279103 ...
 0.434543486684561 ...
 0.0090918242931366 ...
 -0.694002082105726 ...
 0.00786697631701827 ...
 0.72966766403988 ...
 -0.916285449638963 ...
 -0.365635689347982 ...
 -0.972500121686608 ...
 -0.52194854663685 ...
 0.412989234551787 ...
Bias of hidden neurons:
-0.75703962566331 ...
 0.785672763362527 ...
 -0.970745488535613 ...
 0.566242207307369 ...
 -0.82007733406499 ...
 0.0383799616247416 ...
Output arc weights:
1549.89325256581 ...
 21.0406619318848 ...
 12948.6666448985 ...
 3955.67814206896 ...
 27594.6492454141 ...
 -1585.05836751666 ...
Predictions on training set:
3.37230917578193 ...
 7.88376001840254 ...
 7.80014875331645 ...
 7.89066053857323 ...
 9.28505648232478 ...
 7.99818386170826 ...
function (x, ...) 
{
    cat("Call:\\n")
    cat(paste(x$call, "\\n"))
    cat("Number of hidden neurons:\\n")
    cat(paste(x$nhid, "\\n"))
    cat("Activation function:\\n")
    cat(paste(x$actfun, "\\n"))
    cat("Input arc weights:\\n")
    cat(paste(head(x$inpweight), "...\\n"))
    cat("Bias of hidden neurons:\\n")
    cat(paste(head(x$biashid), "...\\n"))
    cat("Output arc weights:\\n")
    cat(paste(head(x$outweight), "...\\n"))
    cat("Predictions on training set:\\n")
    cat(paste(head(fitted(x)), "...\\n"))
}

elmNN documentation built on May 29, 2017, 3:22 p.m.