>  Docs Center  >  ENVI API  >  Classification Framework  >  ENVIGradientDescentTrainer::Train



The Train method iteratively updates the weights of a classifier until the classifier's change in loss falls below a specified convergence criterion or it reaches a specified maximum number of iterations. The weights are updated according to the gradient of the current state of the classifier, using the following formula:

It can also return a loss profile, which can be plotted to examine the convergence of the loss with respect to the training iterations.

See Define and Train the Classifier for more information.


ENVIGradientDescentTrainer.Train, Classifier, Examples [, Keywords=value]



Specify a classifier object such as ENVISoftmaxRegressionClassifier.


Specify an ENVIExamples object.


LOSS_PROFILE (optional)

Specify a variable name that will contain the output loss profile. The result is an array of loss values with one initial value plus one value for each iteration.

Loss is a measure of how closely the classifier algorithm fits the examples. In general, the loss decreases with each iteration until it stops changing. A loss of zero would indicate a perfect fit, but a perfect fit is not necessarily desired. The goal of training is to predict new examples correctly. A fit that is too good might result in overfitting and in a poorer classifier.

ERROR (optional)

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

Version History

ENVI 5.4


API Version


See Also


© 2020 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us