Difference between revisions of "Train one net.m"

From Spinach Documentation Wiki
Jump to: navigation, search
Line 4: Line 4:
 
==Syntax==
 
==Syntax==
  
−
     train_one_net(parameters,trsets,file_number)
+
     train_one_net(parameters,ntraces,file_number)
  
 
==Arguments==
 
==Arguments==
  
 
   parameters  - library and network specification struc-
 
   parameters  - library and network specification struc-
−
                 ture (see the header of [[deer_lib_gen.m]])
+
                 ture (see the header of deer_lib_gen.m)
 
   
 
   
−
   trsets      - sizes of independent randomly generated  
+
   ntraces    - the size of the randomly generated train-
−
                training libraries to sequentially train
+
                 ing library, a minimum of 1e6 is needed.
−
                 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_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.
 
  
 
Two more fields are required in the parameters structure:  
 
Two more fields are required in the parameters structure:  
  
−
  parameters.lastlayer  - activation function to use in
+
  parameters.layer_sizes - number of neurons per layer, a
−
                            the output layer ('tansig',
+
                          row vector where the number of
−
                            'logsig', or 'purelin').
+
                          elements is the number of hid-
 +
                          den layers desired.
 
   
 
   
−
  parameters.layer_sizes - number of neurons per layer, a
+
  parameters.training_target - 'distance_distribution' or
−
                            row vector where the number of
+
                              'background'
−
                            elements is the number of hid-
 
−
                            den layers desired.
 
  
 
==Outputs==
 
==Outputs==
Line 38: Line 34:
  
 
  % Load training set parameters
 
  % Load training set parameters
−
  run('net_set_any_peaks/netset_params.m');
+
  netset_params;
 
   
 
   
−
  % Specify the sizes of training databases to train against
+
  % Specify layer dimensions
−
  trsets=[160e4 160e4 160e4 160e4];
+
  parameters.layer_sizes=[512 512 512 256];
 
   
 
   
−
  % Run the network training for a a single network
+
        % Specify training target
−
  train_one_net(parameters,trsets,111);
+
        parameters.training_target='distance_distribution';
 +
 +
  % Train using 64000 DEER traces
 +
  train_one_net(parameters,64000,111);
  
 
The function will save the the network into 111.mat file.
 
The function will save the the network into 111.mat file.
Line 50: Line 49:
 
==Notes==
 
==Notes==
 
# A CUDA capable NVidia GPU is required.
 
# A CUDA capable NVidia GPU is required.
−
# If the file pre-exists, the network will be loaded and used as the initial guess.
 
  
 
==See also==
 
==See also==

Revision as of 10:25, 10 November 2020

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,ntraces,file_number)

Arguments

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

  ntraces     - the size of the randomly generated train- 
                ing library, a minimum of 1e6 is needed.

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

Two 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.training_target - 'distance_distribution' or
                              'background'

Outputs

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

Examples

The example below will train a single network using the parameters given in the netset_params.m file for the network ensemble optimized for any peak width.

	% Load training set parameters
	netset_params;

	% Specify layer dimensions
	parameters.layer_sizes=[512 512 512 256];

       % Specify training target
       parameters.training_target='distance_distribution';

	% Train using 64000 DEER traces
	train_one_net(parameters,64000,111);

The function will save the the network into 111.mat file.

Notes

  1. A CUDA capable NVidia GPU is required.

See also

Neural network module

DEER/PELDOR experiments


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