NNTRAIN

Neural-network training


EnvironmentsPYTHON :: EASI :: MODELER
Batch ModeYes
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: References :: Related

Back to top

Description


Use NNTRAIN to train a back-propagation neural network for pattern recognition. The neural-network functions, NNCREAT, NNTRAIN, and NNCLASS implement the process of supervised classification of multispectral imagery using training sites.
Back to top

Parameters


Name Type Length Value range
InputNN: Input neural-network segment * Raster port 1 - 1  
BitmapNN: Input training sites to sample data * Bitmap port 1 - 1  
NNLayer: Neural-network layer to train * BIN port 1 - 1  
OutputNN: One or more layers used to train the neural network * Bitmap port 1 - 1  
OutBitNN: Training sites used to train the neural network * Bitmap port 1 - 1  
NNTrained: Trained neural-network layer * BIN port 1 - 1  
Momentum Rate for Neural Network Float 0 - 1 0 - 1.0
Default: 0.9
Learning Rate for Neural Network Float 0 - 1 0.0 - 1.0
Default: 0.1
Maximum Total Error Float 0 - 1 0.0 -
Default: 0.01
Maximum Individual Error Float 0 - 1 0.0 -
Default: 0.001
Maximum Number of Iterations Integer 0 - 1 1 -
Default: 1000
Listing Type String 0 - 1 BRIEF | SHORT | FULL
Default: SHORT
Report String 0 - 192 See parameter description

* Required parameter
Back to top

Parameter descriptions

InputNN: Input neural-network segment

The neural-network segment (type 180) from which to read the input neural-network data and that will receive the trained neural network.

BitmapNN: Input training sites to sample data

One or more input-bitmap layers that make up the training-site mask or masks.

NNLayer: Neural-network layer to train

The neural-network segment (type 180) from which to read the input neural-network data. The segment must be created with NNCREAT.

OutputNN: One or more layers used to train the neural network

On completion, this parameter contains one or more of the image layers used to create the trained neural-network layer.

OutBitNN: Training sites used to train the neural network

On completion, this parameter contains the training sites (type 181) used to create the trained neural-network layer.

NNTrained: Trained neural-network layer

On completion, this parameter contains the output layer (type 180) that receives the trained neural-network layer. The neural-network layer must be created by NNCREAT.

Note: The history of the neural-network segment is updated with the number of training iterations to date, the momentum rate, and the learning rate used. You can view the segment history by running ASL with the value of LTYP set to FULL. For more information on using ASL to view the segment history, see ASL.

Momentum Rate for Neural Network

The momentum rate (between 0.0 and 1.0) for neural-network training. If no value is specified, a rate of 0.9 is applied by default. A high momentum rate allows for the specification of a higher learning rate without the risk of oscillation or non-convergence. The specified momentum rate is saved in the neural-network segment for future report generation.

This parameter is optional.

Learning Rate for Neural Network

The learning rate (between 0.0 and 1.0) for neural-network training. If no value is specified, a learning rate of 0.1 is applied by default. A higher learning rate speeds up the training, but increases the risk of oscillation or non-convergence of the training result. The specified learning rate is saved in the neural-network segment for future report generation.

Maximum Total Error

The maximum normalized total error to allow. If no value is specified, a maximum total error of 0.01 is applied by default. If this error occurs below the value specified, the neural-network processing stops and the NNTRAIN run terminates.

This parameter is optional.

Maximum Individual Error

The maximum individual error to allow for all samples. If no value is specified, a maximum individual error of 0.001 is applied by default. If this error occurs below the value specified for all samples, the neural-network processing stops and the NNTRAIN run terminates.

This parameter is optional.

Maximum Number of Iterations

The maximum number of iterations to run on the neural network. If no value is specified, a maximum number of iterations of 1000 is applied by default. If the number of iterations exceeds the value specified, the neural-network processing stops and the NNTRAIN run terminates.

Note: If the maximum number of iterations is reached before the maximum error (MAXTERR or MAXIERR) is reached, you may want to run NNTRAIN again (to further train the neural network), unless the existing normalized error is acceptable.

This parameter is optional.

Listing Type

The report listing type.

Available report types are:

This parameter is optional.

Report

Specifies where to direct the generated report.

Available options are:

Back to top

Details

NNTRAIN trains an existing neural-network segment created with NNCREAT for back-propagation neural-network processing using sample data from training sites. When the neural-network training reaches a specified maximum acceptable error or the maximum number of iterations, training terminates. NNCLASS uses the trained neural network to classify imagery.

The input PCIDSK image file (FILE) contains the neural-network segment (DBNNS) to be trained. This segment contains the following control information, initialized on running NNCREAT:

The momentum rate (MOMEN) and learning rate (LEARN) for building the neural network can be specified. For more information, see Training later in this topic.

NNTRAIN continues training the neural network until one of the following three conditions is reached:

Typically, the neural network is trained when NNTRAIN completes when either of the first two conditions have been met. If NNTRAIN completes because it exceeds the maximum allowable number of iterations, NNTRAIN may need to be run again if the total normalized error is still too large.

LTYP (Listing Type) specifies whether to print a BRIEF report, where only the error plot is reported; a SHORT report, where the first 10 samples per class are reported; or a FULL report, where all samples are reported. A FULL report should be produced only if there are a few samples.

Training

Back-propagation neural networks need to be trained to learn the input patterns of interest. When the neural-network segment is first created by NNCREAT, the weights for the inter-unit connections are initialized to random values in the range of -0.5 to +0.5. If a classification is performed with NNCLASS before training the neural network, the classification results are completely random. (NNCLASS checks the number of training iterations and will not run if the neural network is untrained.)

Typically, back-propagation neural networks require a number of iterations (100 to 10000) before the interconnection weights stabilize enough to recognize the input patterns. If NNTRAIN terminates when the specified number of iterations (MAXIT) is reached and the specified individual error (MAXTERR or MAXIERR) has not been met, the network may need to be trained again with NNTRAIN. If it still does not converge, you may need to redefine the neural network (using different input channels, more accurate bitmaps, more input and hidden units, or more samples).

The learning and momentum rates affect how quickly the neural network stabilizes. A high learning rate (0.9) converges quickly, but may exit prematurely. A low learning rate (0.1) takes more iterations to train, but has less of a tendency to exit prematurely. The risk of using a high learning rate is that the modeling may oscillate and not stabilize. You can observe how different learning rates converge by examining the error plot in the output report.

The momentum rate can be used to speed up learning. A high momentum rate (0.9) trains with larger steps than a lower rate (0.1). Using a momentum term helps reduce oscillation between iterations and allows a higher learning rate to be specified without the risk of non-convergence.

Before running NNTRAIN, NNCREAT should be run to completion with the parameters defined as described in the corresponding NNCREAT Help topic.

Back to top

References

The code for NNTRAIN was adapted from a program written by M. S. Klassen and Y. H. Pao (1989) and modified by A. Zhang (1993).

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.