Neural Network Toolbox Previous page   Next Page
train

Train a neural network

Syntax

[net,tr,Y,E,Pf,Af] = train(net,P,T,Pi,Ai,VV,TV)

To Get Help

Type help network/train

Description

train trains a network net according to net.trainFcn and net.trainParam.

train(NET,P,T,Pi,Ai,VV,TV) takes,

and returns,

Note that T is optional and need only be used for networks that require targets. Pi and Pf are also optional and need only be used for networks that have input or layer delays.

Optional arguments VV and TV are described below.

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

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:

where

The columns of Pi, Pf, Ai, and Af are ordered from the oldest delay condition to the most recent:

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.

Each matrix argument is found by storing the elements of the corresponding cell array argument into a single matrix:

If VV and TV are supplied they should be an empty matrix [] or a structure with the following fields:

The validation vectors are used to stop training early if further training on the primary vectors will hurt generalization to the validation vectors. Test vector performance can be used to measure how well the network generalizes beyond primary and validation vectors. If VV.T, VV.Pi, or VV.Ai are set to an empty matrix or cell array, default values will be used. The same is true for TV.T, TV.Pi, TV.Ai.

Examples

Here input P and targets T define a simple function which we can plot:

Here newff is used to create a two-layer feed-forward network. The network will have an input (ranging from 0 to 8), followed by a layer of 10 tansig neurons, followed by a layer with 1 purelin neuron. trainlm backpropagation is used. The network is also simulated.

Here the network is trained for up to 50 epochs to a error goal of 0.01, and then resimulated.

Algorithm

train calls the function indicated by net.trainFcn, using the training parameter values indicated by net.trainParam.

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.

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.

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 presents each input vector once in random order.

See Also

sim, init, adapt, revert


Previous page  tansig trainb Next page

© 1994-2005 The MathWorks, Inc.