Difference between revisions of "Train one net.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(→‎Outputs)
(Update function See also links and function index membership)
 
(18 intermediate revisions by 2 users not shown)
Line 1: Line 1:
−
{{DISPLAYTITLE:train_one_net.m}}
+
{{DISPLAYTITLE:train_one_net.m}} __NOTOC__
−
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.
+
Trains a network and writes a file with the specified number. If the specified file exists, the function will load that network file and continue training.
  
 
==Syntax==
 
==Syntax==
  
−
    train_one_net(parameters,trsets,file_number)
+
    train_one_net(parameters,batch_size,file_number)
  
−
==Arguments==
+
==Parameters==
  
−
  parameters  - library and network specification struc-
+
    parameters  - library and network specification struc-
−
                ture (see the header of [[deer_lib_gen.m]])
+
                  ture (see [[deer_lib_gen.m]])
 
   
 
   
−
  trsets      - sizes of independent randomly generated  
+
    batch_size  - the number of training examples randomly  
−
                training libraries to sequentially train
+
                  generated at each iteration; must fit in
−
                against. [160k 160k 160k 160k 160k 160k]
+
                  memory
−
                works well on a Tesla V100 card.
 
 
   
 
   
−
  file_number - the network object will be saved into a
+
    file_number - the network object will be saved into a
−
                file with this number as the name, this
+
                  file with this number as the name
−
                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==
−
This function writes a .mat file with the network object.
+
This function writes a MAT file with the network object and the parameters structure.
−
 
 
−
==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==
 
==Notes==
 +
# A strong NVidia GPU is required - at least a Titan V
 +
# If the file pre-exists, the network will be loaded and used as the initial guess.
  
 
==See also==
 
==See also==
−
'''Functions used'''
+
[[deer_lib_gen.m]], [[deernet.m]], [[dist_range.m]], [[elexsys2deernet.m]], [[process_using.m]], [[Neural network module]], [[Built-in_experiments]]
−
 
 
−
[[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]]''
+
''Version 2.8, authors: [[Ilya Kuprov]], [[Steve Worswick]], [[Jake Keeley]], [[Tajwar Choudhury]]''

Latest revision as of 18:42, 6 June 2026

Trains a network and writes 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,batch_size,file_number)

Parameters

   parameters  - library and network specification struc-
                 ture (see deer_lib_gen.m)

   batch_size  - the number of training examples randomly 
                 generated at each iteration; must fit in
                 memory

   file_number - the network object will be saved into a
                 file with this number as the name

Outputs

This function writes a MAT file with the network object and the parameters structure.

Notes

  1. A strong NVidia GPU is required - at least a Titan V
  2. If the file pre-exists, the network will be loaded and used as the initial guess.

See also

deer_lib_gen.m, deernet.m, dist_range.m, elexsys2deernet.m, process_using.m, Neural network module, Built-in_experiments

Version 2.8, authors: Ilya Kuprov, Steve Worswick, Jake Keeley, Tajwar Choudhury