elmtrain: Training of a SLFN (Single Hidden-layer Feedforward Neural...

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

View source: R/elmtrain.R

Description

Training of a generic SLFN using ELM algorithm. First it generates input weights and hidden layer bias ( both randomly choosen ), then calculates the output from the hidden layer ( given a particular activation function as a parameter ) and at the end calculates output weights of the neural network. It returns an ELM model ( an object of class elmNN ) representing the trained neural network.

Usage

1
2
3
4
5
elmtrain(x, ...)
## S3 method for class 'formula'
elmtrain(formula, data, nhid, actfun, ...)
## Default S3 method:
elmtrain(x, y, nhid, actfun, ...)

Arguments

formula

a symbolic description of the model to be fitted.

data

training data frame containing the variables specified in formula.

x

training dataset.

y

target output of the training dataset.

nhid

number of hidden neurons. Must be >= 1.

actfun

type of activation function. Furthermore a list of the implemented activation functions.
- sig: sigmoid
- sin: sine
- radbas: radial basis
- hardlim: hard-limit
- hardlims: symmetric hard-limit
- satlins: satlins
- tansig: tan-sigmoid
- tribas: triangular basis
- poslin: positive linear
- purelin: linear

...

not used.

Details

Note: since part of ELM algorithm is random ( setting of the input weights and hidden layer bias ), output results of same activation function and same number of hidden neurons may change. To find the most accurate error rate for a fixed setting, it is convenient to make various test on the datasets (i.e. 20 times) using the same settings and calculate the mean error from these tests.

Value

returns the trained neural network, an object of class elmNN.

nhid

number of hidden neurons selected

actfun

activation function used

inpweight

matrix of input weights ( randomly choosen )

biashid

vector of hidden layer bias ( randomly choosen )

outweight

matrix of output weights ( calculated by the algorithm )

Author(s)

Alberto Gosso

References

see elmNN-package documentation.

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
set.seed(1234)
##'formula' version
Var1 <- runif(50, 0, 100) 
sqrt.data <- data.frame(Var1, Sqrt=sqrt(Var1))
model <- elmtrain(Sqrt~Var1, data=sqrt.data, nhid=10, actfun="sig")
new <- data.frame(Sqrt=0,Var1 = runif(50,0,100))
p <- predict(model,newdata=new)

##Default version
Var2 <- runif(50, 0, 10) 
quad.data <- data.frame(Var2, Quad=(Var2)^2)
model <- elmtrain(x=quad.data$Var2, y=quad.data$Quad, nhid=10, actfun="sig")
new <- data.frame(Quad=0,Var2 = runif(50,0,10))
p <- predict(model,newdata=new$Var2)

## The function is currently defined as
function (x, ...) 
UseMethod("elmtrain")

Example output

Loading required package: MASS
function (x, ...) 
UseMethod("elmtrain")

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