Differences between train and adapt functions in the MATLAB Neural Network Toolbox

Source: Internet
Author: User

Go to: http://www.matlabsky.com/thread-4084-1-1.html

Let's take a look at the official interpretation of MATLAB. Please perform the following operations:


In the command window of Matlab, enter Doc adapt or Doc train and drag the scroll bar to the end with an algorithm description. Here we will introduce the calculation of two functions.


Adapt

  1. Adapt callthe function indicated by net. adaptfcn, using the adaption parameter values indicated by net. adaptparam.

  2. Given an input sequence with TS steps, the network is updated as follows: each step in the sequence of inputs is presented to the network one at a time. the network's weight and bias values are updated after each step, before the next step in the sequence is
    Presented. Thus the network is updated ts times.

  3. This means that the input and output sample pairs gradually "adjust" the weights of the network one by one based on the TS time delay. Each time a sample is given to the network, the network is updated once based on the sample data. If n samples exist, the network is updated n times. Of course, you can also input the sample set to the network after entering all samples. A sample set (sequence of inputs) is called a "pass ". The number of sample sets should be equal to ts, that is, n = ts.

Copy code

Train

  1. Train callthe function indicated by net. trainfcn, using the training parameter values indicated by net. trainparam.

  2. Typically one epoch of training is defined as a single presentation of all input vectors to the network. The network is then updated according to the results of all those presentations.

  3. Training occurs until a maximum number of epochs occurs, the performance goal is met, or any other stopping condition of the function net. trainfcn occurs.

  4. Some training functions depart from this norm by presenting only one input vector (or sequence) each epoch. an input vector (or sequence) is chosen randomly each epoch from concurrent input vectors (or sequences ). NEWC and Newsom return networks that use trainr,
    A training function that does this.

  5. That is to say, all the training samples are involved in the training process, even if the network only iterates once. Training iterates the matrix of weights based on performance functions (or error functions), but adjustment does not, only one error value is given.

Copy code

Let's look at the built-in interpretation of the MATLAB help system.

  1. One kind of general learning function is a network training function. training functions repeatedly apply a set of input vectors to a network, updating the network each time, until some stopping criteria is met. stopping criteria can consists of a maximum number
    Of epochs, a minimum error gradient, an error goal, etc.

  2. The other kind of the general learning function is a netowrk adapt function. Adapt functions simulate a network, while updating the network for each time step of the input before continuing the simulation to the next input.

Copy code

In Matlab, neural network training is divided into batch training and incremental training ).

If train is used to train the network, it is batch training, and adapt can implement both batch training and growth training, depending on the neural network's input form being parallel input (concurrent inputs) or sequential inputs. If it is the former, batch training is implemented. If it is the latter, the training is increased.


Batch training means that the weights and thresholds of all inputs are updated only once after a neural network is input. Growth training refers to updating the weights and thresholds for each input.


The format of the so-called parallel input is in the form of an array. That is, [1, 2, 4] is a parallel input, and the input is in no particular order. Serial input is represented by cell array {}, for example, {[1; 3], [2; 4]}. The input is sequential.


In other words, whether it is serial or parallel depends on the format of the input sample ("[]" or "{}") instead of a parameter in the neural network.


But for train (), even if your input is a serial input, it may automatically convert the input into parallel input for batch training. In short, train can only be used for batch training. Both adapt and adapt can be used (batch training or growth training). The input format is used to determine how to perform the training. It is determined by both input and sequential input, not by specifying the serial or parallel parameters. However, for the train method, even if your input is sequential input, it may automatically convert the input to simultaneous input for batch training. In short, train can only be used for batch training.



For example, there are 100 training samples

1. Train: Adjust the network parameters once the 100 samples are dropped for network computing.

2. adapt: If [] is input, this is equivalent to train. If {} is input, the sample is input one by one, and each input sample data is calculated, and then the network parameters are adjusted once, therefore, we need to adjust it for 100 times.


Note that not all training and learning functions support incremental training)


Finally, let's look at an official explanation.

  1. Adapt/train's signal arguments can have two formats: cell array or matrix.

  2. The cell array format is easiest to describe. It is most convenient for networks with multiple inputs and outputs, and allows sequences of inputs to be presented.

  3. The matrix format can be used if only one time step is to be simulated (TS = 1 ). it is convenient for networks with only one input and output, but can be used with networks that have more.

Copy code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.