|
5.1.6 SetNeuralD, NeuralD, and NNModelInfo
The commands SetNeuralD, NeuralD, and NNModelInfo are intended primarily for internal use in the package, but they might be useful if you want to perform more special operations.
SetNeuralD and NeuralD help you to compute the derivative of an FF or a radial basis function network and they might be useful if you write your own training algorithm. SetNeuralD does not return any object but produces optimal code for the specific network structure, which then is used by NeuralD. Hence, each time the network structure is changed, SetNeuralD has to be called prior to NeuralD.

Generate optimal code for NeuralD, which is used to compute the derivative of a network.

Options of SetNeuralD.
The numerical derivative of a network is obtained using NeuralD.

Computation of the derivative of a network.
NeuralD can be applied to a matrix with one numerical input vector on each row. The output is a three-dimensional list: the first level indicates the data, the second level has one component for each network output, and the third level has one component for each parameter.
Notice that you only have to call SetNeuralD once for a specific network. The current parameter values, submitted in the argument net, are used each time NeuralD is called.
You may use SetNeuralD and NeuralD in any of your own training algorithms in the following way. First the network structure is determined. Then SetNeuralD is called to obtain the optimized code. The actual training often consists of a loop containing the computation of the derivative and a parameter update. You use NeuralD to obtain the derivative at the parameter values given in the network in the call. Section 7.9, Writing Your Own Training Algorithms, illustrates the use of SetNeuralD and NeuralD.
To save computer time, and since NeuralD is intended to be used inside a loop, there is no security check of the input arguments. Hence, you have to include these yourself, preferably outside the loop.
NNModelInfo gives you exactly the specification needed to create a new neural network with the same structure. This specifies the network with the exception of the parameter values.

Structure specification about a feedforward network.
NNModelInfo returns a list of four variables that contains the following: number of inputs, number of outputs, number of hidden neurons, and a list of options used when the model was defined.
|