Difference between revisions of "Train one net.m"
(→Arguments) |
|||
| Line 19: | Line 19: | ||
file with this number as the name, this | file with this number as the name, this | ||
file also serves as a restart checkpoint. | file also serves as a restart checkpoint. | ||
| + | |||
| + | Three more fields are required in the parameters structure: | ||
| + | |||
| + | parameters.layer_sizes - number of neurons per layer, a | ||
| + | row vector where the number of | ||
| + | elements is the number of hid- | ||
| + | den layers desired. | ||
| + | |||
| + | parameters.lastlayer - activation function to use in | ||
| + | the output layer ('tansig' or | ||
| + | 'logsig'). | ||
| + | |||
| + | parameters.method - training algorithm ('trainscg' | ||
| + | is recommended). | ||
==Outputs== | ==Outputs== | ||
Revision as of 09:37, 23 August 2018
Generates a training library, trains a network and writes it into a file with the specified number. If the specified file exists, the function will load that network file and continue training.
Syntax
train_one_net(parameters,trsets,file_number)
Arguments
parameters - library and network specification struc-
ture (see the header of deer_lib_gen.m)
trsets - sizes of independent randomly generated
training libraries to sequentially train
against. [160k 160k 160k 160k 160k 160k]
works well on a Tesla V100 card.
file_number - the network object will be saved into a
file with this number as the name, this
file also serves as a restart checkpoint.
Three more fields are required in the parameters structure:
parameters.layer_sizes - number of neurons per layer, a
row vector where the number of
elements is the number of hid-
den layers desired.
parameters.lastlayer - activation function to use in
the output layer ('tansig' or
'logsig').
parameters.method - training algorithm ('trainscg'
is recommended).
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