NAME
mlp_net -- multilayer perceptron
PROTOTYPE
unitptr mlp_net( int inpins, int hlayers, int hnodes[], float(*f)(float), float(*df)(float), char *pcOpt, unittype *dest)
ARGUMENTS
- int inpins
- nr of input lines
- int hlayers
- number of weight layers
- int hnodes[]
- array with number of nodes for layers h, h=0..hlayers-1 ( h=0 references the first hidden layer, h=hlayers-1 the output layer).
- float(*f)(float)
- activation function for inner neurons
- float(*df)(float)
- this function is used as the derivative of f
- char *pcOpt
- options: %R for resilient backpropagation, %W to make weights accessible at extra output field, %S for weight sharing mode.
- unittype *dest
- host unit
INTERFACE:
Inputs:
- X_in[inpins]
- (input field 0) input vector x
- Y_in[dout]
- (input field 1) error input vector d=target-X_out.
Dimension dout is given by hnodes[abs(hlayers)-1].
- Z_in[]
- optional input field with one float vector pin per weight layer.
This field is only present, when the weight share option
%S was specified.
The dimension of the pin for a weight layer between
two neuron layers with h and h' neurons is given by
(1+h)*h'. Each group of 1+h successive values provides
the bias and the h input weights to one of the h' neurons
of the next layer.
- Eps_in[3]
- adaptation gain Eta, momentum parameter
Alpha and decay rate Gamma
- Ctl_in[1]
- (control input) The integer part of this value specifies
the epoch length (error gradients will be internally
accumulated over an epoch and only at the last epoch step
a weight change, using the accumulated gradients, will be made).
A value of 1 yields on-line learning. A value of 0 skips
any execution and adaptation operations.
Outputs:
- X_out[dout]
- (output field 0) network output (=node activity vector) y
dout=.hnodes[abs(hlayers)-1], as above.
- Y_out[inpins]
- (output field 1) backpropagated error vector (NOTE: if
several mlp_net's and or bp_layer's are connected, this field
must be connected to Y_in[] of the preceding unit).
- Z_out[hnum]:
- (optional packed output field 2) This field is present,
if pcOpt!=NULL. It has one pin holding for each hidden node
its activity value. Thus, hnum=abs(hnodes[0])+abs(hnodes[1])+
..abs(hnodes[abs(hlayers)-2]).
- out_4[]
- weight values. The structure of this field is analogous to
Z_in[] and either Z_in[] or out_4[] is present, but never
both. The presence of out_4[] requires the presence of
the %W-option and the absence of the weight sharing
mode option %S. If %S is present, a weight field
Z_in[] will be created, irrespective of the %W option.
DESCRIPTION:
Creates a multilayer perceptron with hlayers weight layers, an input layer of
inpins nodes, and abs(hlayers) successive bp_layers of node numbers given in
array hnodes[0,1,...abs(hlayers)-1]. If hlayers<0, the last (=output) layer
will use a linear transfer function, otherwise the transfer function is the
same as for all other nodes and is specified by argument f (a value of NULL
selects the fermi function).
The values of inpins and the hidden node numbers may be negative
(this gives rise to the use of vector pins and is also somewhat faster).
EXECUTION AND ADAPTATION:
This unit is just a convenient wrapper for concatenating a number of
bp_layers. Thus, its execution and adaptation follows the same
equations as given in the documentation of the bp_layer unit.
In particular, CTL_in[0] again specifies whether on-line learning
(value=1) or epoch learning (value=epoch length) shall be used,
and the option %R selects use of the resilient backprop
algorithm.
TREATMENT OF MISSING VALUES:
The input vector and the error difference vector
may contain elements with the non-value NaN.
In both cases, such elements are treated as if zero;
thus they neither affect the activity computation nor the
error backpropagation and act as if they were missing
values.
LOAD AND SAVE:
Saves the internal weights, unless the unit operates in
weight sharing mode (%S-option). In this case, no weights
need to be saved, since weight values are obtained from
the attached `weight host unit'' (whose weights are saved,
since it does operate in normal mode).
SEE ALSO:
bp_layer
FILE
/homes/jontrup/nst5/man/../o.sol2//../foldersrc/nst_adaptive.c