ENVIGradientDescentTrainer
This function uses a Gradient Descent algorithm to train a classifier that reports a gradient; for example, Softmax Regression. The Gradient Descent algorithm 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:
The learning rate, convergence criterion, and maximum iterations needed to effectively train a classifier (not just each classifier type, but each classifier instance) can vary considerably. They often take some experimentation to determine.
The following diagram shows a typical workflow where the gradient descent trainer is used:
Example
See the following topics for code examples:
Syntax
Result = ENVIGradientDescentTrainer([, Keywords=value])
Return Value
This function returns a reference to an ENVIGradientDescentTrainer object.
Methods
Dehydrate
GetParameters
GetProperties
Hydrate
Save
Train
Keywords
CONVERGENCE_CRITERION (optional)
Set this keyword to a convergence criterion. Ideally, with each iteration, the change in loss value decreases until it meets a specified threshold, below which iterations can stop. This threshold is the convergence criterion. If you do not set this keyword, the default value is 0.001.
LEARNING_RATE (optional)
Set this keyword to the step size to use for updating the classifier weights. If you do not set this keyword, the default value is 0.1.
MAXIMUM_ITERATIONS (optional)
Set this keyword to the maximum number of iterations to perform if the convergence criterion is not met. If you do not set this keyword, the default value is 100.
PROPERTIES
Set this keyword to an IDL dictionary containing the following properties:
- Convergence_Criterion: Required. Ideally, with each iteration, the change in loss value decreases until it meets a specified threshold, below which iterations can stop. This threshold is the convergence criterion. A suggested starting value is 0.0001.
- Learning_Rate: Required. Specify the step size to use for updating the classifier weights. A suggested starting value is 0.1.
- Maximum_Iterations: Required. Specify the maximum number of iterations to perform if the convergence criterion is not met. A suggested starting value is 100.
Here is an example of a dictionary:
Properties = Dictionary()
Properties.Convergence_Criterion = 0.001
Properties.Learning_Rate = 0.1
Properties.Maximum_Iterations = 100
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.
URI (optional)
Set this keyword to a string with the fully qualified filename and path of the output object. If you specify a URI, the Save method will use that URI. You can restore the object later using ENVIRestoreObject.
Version History
API Version
3.3
See Also
ENVIIterativeTrainer, ENVIGradientDescentTrainerTask, ENVISoftmaxRegressionClassifier, ENVIExamples