|
The function
nnrnet
allows for constructing and training a
single hidden layer network with maximal 100 units.
The call looks like
net = nnrnet (x, y, w, size, param, wts)where x and y are the input and output variables. Note that x as well as y can consist of several variables (columns). We assume that x and y have dimensions n x I and n x Q, respectively.
With the w parameter, we can associate a prior weight to each observation. This is useful, e.g. for ties in the data. Note that the prior weights w have nothing in common with the weights calculated in the net.
The parameter size determines the number of units in the hidden layer. The total number of units must not exceed 100, i.e.
The default network is a classification network: logistic output
units, no softmax, no ``skip-layer'' connections,
no weight decay and the training stops after 100
iterations. The default model for the output units yk, ,
is hence
The result of
nnrnet
is a composed object net.
More information on the components of net can be found
in Subsection 2.2.
The function
nnrinfo
shows a short information
about the fitted network. The result of
nnrinfo(net)could for example print the following information in the output window:
[ 1,] "A 2 - 1 - 1 network:" [ 2,] "# weights : 5" [ 3,] "linear output : no" [ 4,] "error function: least squares" [ 5,] "log prob model: no" [ 6,] "skip links : no" [ 7,] "decay : 0" [ 8,] "" [ 9,] " From To Weights" [10,] " 0 3 -0.751" [11,] " 1 3 0.81" [12,] " 2 3 0.575" [13,] " 0 4 -4.95" [14,] " 3 4 14.8"The abbreviation 2 - 1 - 1 means two input units, one hidden layer and one output unit. Altogether five weights wst have been calculated, the values of these weights are given in the last lines. The other items show which parameters have been specified for the network.
Typically, a neural network is applied to a subsample of the data
which is used as a training data set. The remaining observations
are then used to validate the network. To compute predicted
values for the validation set,
nnrpredict
is used:
ypred = nnrpredict (xval, net)
Since the result of a neural network fitting is a composed object, two convenient functions for saving and loading neural networks are provided. The network net can be stored into a set of files by
nnrsave (net, "mynet")All created files start with the prefix mynet. The network can be reloaded by
net = nnrload ("mynet")
The type of a network and the control parameters for the
iteration are determined by the parameter param
of
nnrnet. If, for instance, a model different to the default
is fitted, this parameter needs to be modified.
param is a vector of eight elements:
The result of
nnrnet
is a composed object, the list net,
which contains the resulting fit and
information about the network. The components are the following:
![]() |
MD*TECH Method and Data Technologies |
http://www.mdtech.de mdtech@mdtech.de |