train_one_net.m
Constructs a MATLAB neural network object and runs the training for a single neural network. The function first generates a unique training library using supplied parameters (see deer_lib_gen.m), a neural netwok object is then constructed and the training carried out as specified in the input.
If there is already a network with the specified name present in the directory, the function will attempt to load that network file and continue training from the checkpoint with a previously unseen training dataset. The function will sequentially train a network against multiple training sets if specified in the input.
Syntax
train_one_net(parameters,trsets,file_number)
Arguments
parameters - structure containing training library
and network design specifications.
trsets - size of training database to use in
training. May be supplied as a horizontal
vector to allow sequential training with
multiple databases.
file_number - number used as an identifier for
saving the network object.
Three further fields are required in the parameters structure, in order to specify the neural network design:
parameters.layer_sizes - number of neurons per layer, expected
as a horizontal vector where the number
of elements is the number of hidden
layers desired.
parameters.lastlayer - activation function to use in the
neural network output layer.
parameters.method - neural network training algorithm
selection.
Outputs
The only output produced by this function is the network, saved as "file_number".mat in the working directory.
Examples
The example below will train a single network using the parameters described in the netset_params.m file for the network ensemble optimized for any peak width.
This example can be run from within examples/deernet/:
% Load training set parameters
run('net_set_any_peaks/netset_params.m');
% Specify the sizes of training databases to train against
trsets=[160e4 160e4 160e4 160e4];
% Run the network training for a a single network
train_one_net(parameters,trsets,111);
The function will save the output file "111.mat" to the working directory.
NOTE: For the network and training set dimensions used here, a high performance Nvidia GPU is required (e.g. Nvidia Tesla K40). Training set sizes may be decreased to fit on available hardware but this will sacrifice performance of the trained model.
Notes
Computing resources
The function requires at least one Nvidia GPU, multiple GPUs will be used where available.
Selected network design parameters
parameters.layer_sizes
This parameter is used to specify the number of hidden layers and the number of neurons per layer:
- the number of neurons in the first layer must be equal to the point count used in the training set (parameters.npoints),
- when the network is constructed, a final "output" layer is automatically added to the network. The number of neurons in this layer is set to be equal to the length of the output vector during training,
- any number and any size of intermediate layers may be specified in the parameters, we have found that networks with uniform intermediate layer achieve the best practical performance,
- the training process may be slightly sped up by using intermediate layers with fewer neurons, but any reduction in the dimensions comes with some degredation of network performance.
parameters.lastlayer
This parameter is used to select the activation function for the neurons in the final layer, we suggest the Logistic Sigmoid ('logsig') activation function is used.
- The distance distribution is a non-negative function, we have found that including this knowledge at the network level by using the non-negative Logistic Sigmoid activation function results in better performance and faster training (see supplementary Table S1 of our paper).
parameters.method
This parameter is used to select the training algorithm to employ in training. We suggest using either RPROP or SCG-BP:
- RPROP (MATLAB 'trainrp')- resilient backpropagation algorithm of Riedmiller and Braun.[1]
- SCG-BP(MATLAB 'trainscg')- scaled conjugate gradient backpropagation algorithm of Martin Møller.[2]
Default network design parameters
The parameters below are set to default values:
Hidden layer activation function
The hyperbolic tangent sigmoid ('tansig') activation function is used in the intermediate layers.
Performance function and weight regularization
The sum of squared errors (SSE) performance function is used, modified to penalise large learned network parameters by adding a sum of the squared weights term.
This method is called weight regularization (or shrinkage) and is used to avoid overfitting to the training data.
Stopping criteria and data division
The early stopping technique is used. The training database is divided into two subsets:
- Training set (70%) - used for training the network.
- Validation set(30%) - monitored during training in order to avoid overfitting of the network to the training set.
Training is stopped when the error on the validation set increases for 100 iterations while the error on the training set continues to decrease.
Data pre- and post-processing
Training data is generated ready for use (see deer_lib_gen.m). No pre- or post-processing of the training data is included at the the neural network level.
See also
Functions used
deer_lib_gen.m, netset_params.m
Other related functions
deernet.m, netset_curate.m, process_using.m
References
[1] M. Riedmiller, H. Braun, A Direct Adaptive Method for Faster Backpropagation Learning: The RPROP Algorithm, in IEEE International Conference on Neural Networks, IEEE, San Francisco, 1993, vol. 1,pp. 586-591.
[2] Moller, A Scaled Conjugate Gradient Algorithm for Fast Supervised Learning, Neural Networks, Vol. 6, 1993, pp. 525–533
Version 2.2, authors: Ilya Kuprov, Steve Worswick