Difference between revisions of "Process using.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(Created page)
 
Line 1: Line 1:
 
{{DISPLAYTITLE:process_using.m}}
 
{{DISPLAYTITLE:process_using.m}}
−
Runs the processing on a supplied DEER trace using a specified network file.
+
Applies the specified trained neural network file to the supplied DEER trace.
  
 
==Syntax==
 
==Syntax==
Line 8: Line 8:
 
==Arguments==
 
==Arguments==
  
−
    deer_traces   - DEER trace(s) as a column vector or a  
+
  deer_traces - DEER trace(s) as a column vector or a  
−
    matrix of multiple columns. The number
+
                  matrix with multiple columns. The num-
−
    of rows must be equal to the number of  
+
                  ber of rows must match the input size
−
    neurons in the network input layer.
+
                  of the neural network.
−
 
+
−
    net_file_name - the name of the checkpoint file prod-
+
  net_file_name - the name of the checkpoint file produ-
−
    uced during network training.  
+
                  ced by the train() function of Matlab
−
                     
+
                  Neural Network Toolbox, including the
 +
                  full path and the .mat extension.
  
 
==Outputs==
 
==Outputs==
  
−
    answers       - distance distribution(s) as a column
+
  answers       - neural network output(s) as a column  
−
    vector or a matrix of multiple colum-
+
                  vector or a matrix with multiple col-
−
    ns.The number of rows is defined by
+
                  umns. The number of rows mathes the
−
    the number of neurons in the output  
+
                  output size of the neural network.
−
    layer of the network.
 
  
 
==Examples==
 
==Examples==

Revision as of 10:02, 23 August 2018

Applies the specified trained neural network file to the supplied DEER trace.

Syntax

    answers=process_using(deer_traces,net_file_name)

Arguments

  deer_traces  -  DEER trace(s) as a column vector or a 
                  matrix with multiple columns. The num-
                  ber of rows must match the input size 
                  of the neural network.

  net_file_name - the name of the checkpoint file produ-
                  ced by the train() function of Matlab
                  Neural Network Toolbox, including the
                  full path and the .mat extension.

Outputs

  answers       - neural network output(s) as a column 
                  vector or a matrix with multiple col-
                  umns. The number of rows mathes the 
                  output size of the neural network.

Examples

In the example below, a batch of 100 distribution and DEER trace pairs are generated and then

       % Load the parameters
       run('net_set_any_peaks/netset_params.m'); 

       % Specify number of traces to produce
       parameters.ntraces=100;
 
       % Generate test batch
       [time_grid,dist_grid,dist_distr_lib,~,~,deer_trace_lib,~,~,parameters]=deer_lib_gen([],parameters);

       % Run the analysis on the example set
       answers=process_using(deer_trace_lib,'net_set_any_peaks/1.mat');

The network answers can be plotted against the correct answer:

       % Plot an example
       example=randi(100); figure; 
       subplot(1,2,1); plot(time_grid,deer_trace_lib(:,example)); 
       title('Input DEER trace');
       xlabel('time, $\mu$s','interpreter','LaTex');
       subplot(1,2,2); plot(dist_grid,[answers(:,example) dist_distr_lib(:,example)]); 
       title('Output distribution');
       xlabel('distance, $\rm{\AA}$','interpreter','LaTex');
       legend('Network answer','True answer');

Notes

  • Input and intermediate layers must have the 'tansig' activation function.
  • The function supports 'logsig' or 'tansig' activation functions in the output layer, if a different function is detected then an error will be returned.
  • The function assumes a simple feed-forward network topology.
  • The number of points in the input signal must equal the input layer dimensions.
  • The output signal length will be defined by the network output layer dimensions.
  • Network layers are not required to be uniform.

See also

deernet.m, netset_curate.m


Version 2.2, authors: Ilya Kuprov, Steve Worswick