initnw: Initialize networks weights and biases

Description Usage Arguments Details Value References Examples

View source: R/brnn.R

Description

Function to initialize the weights and biases in a neural network. It uses the Nguyen-Widrow (1990) algorithm.

Usage

1
     initnw(neurons,p,n,npar)

Arguments

neurons

Number of neurons.

p

Number of predictors.

n

Number of cases.

npar

Number of parameters to be estimate including only weights and biases, and should be equal to neurons*(1+1+p)+1.

Details

The algorithm is described in Nguyen-Widrow (1990) and in other books, see for example Sivanandam and Sumathi (2005). The algorithm is briefly described below.

Value

A list containing initial values for weights and biases. The first s components of the list contains vectors with the initial values for the weights and biases of the k-th neuron, i.e. (ω_k, b_k, β_1^{(k)},...,β_p^{(k)})'.

References

Nguyen, D. and Widrow, B. 1990. "Improving the learning speed of 2-layer neural networks by choosing initial values of the adaptive weights", Proceedings of the IJCNN, 3, 21-26.

Sivanandam, S.N. and Sumathi, S. 2005. Introduction to Neural Networks Using MATLAB 6.0. Ed. McGraw Hill, First edition.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
#Load the library
library(brnn)

#Set parameters
neurons=3
p=4
n=10
npar=neurons*(1+1+p)+1
initnw(neurons=neurons,p=p,n=n,npar=npar)


## End(Not run)

Example output

Loading required package: Formula
Nguyen-Widrow method
Scaling factor= 0.7812862 
[[1]]
[1]  0.23904285 -0.78128622  0.46223081 -0.46160227 -0.06406419  0.42375697

[[2]]
[1]  0.06106993  0.00000000  0.04627102 -0.46125063  0.44385436 -0.44554273

[[3]]
[1] -0.4838469 -0.7812862 -0.6830166 -0.1041301  0.1705449 -0.3224405

brnn documentation built on Sept. 10, 2021, 1:06 a.m.

Related to initnw in brnn...