0

Raster: This is an array of the same raster 100 times, as I want to repeat the process 100 times on the same raster.
ROI: region of interest points.

foreach iterator_1, raster, iterator_1_index do begin

ExtractTask= ENVITask('ExtractExamplesFromRaster')
ExtractTask.input_rois = ROI
ExtractTask.input_raster = Raster
ExtractTask.Execute

ShuffleTask= ENVITask('ShuffleExamples')
ShuffleTask.input_examples = ExtractTask.output_examples
ShuffleTask.Execute

; Split the examples into training and evaluation sets

SplitTask = ENVITask('SplitExamples')
SplitTask.input_examples = SplitTask.output_examples
SplitTask.output_examples_uri = ["0", "1"]
SplitTask.Execute
splitExamples = splitTask.OUTPUT_EXAMPLES

; Define the Softmax classifier input properties

softmaxTask = ENVITask('CreateSoftmaxRegressionClassifier')
softmaxTask.CLASS_NAMES = outExamples.CLASS_NAMES
softmaxTask.NATTRIBUTES = outExamples.NATTRIBUTES
softmaxTask.NCLASSES = outExamples.NCLASSES
softmaxTask.Execute

; Run the Gradient Descent trainer

GDTask = ENVITask('CreateGradientDescentTrainer')
GDTask.CONVERGENCE_CRITERION = 0.0001
GDTask.LEARNING_RATE = 60
GDTask.MAXIMUM_ITERATIONS = 800
GDTask.Execute

trainTask = ENVITask('TrainClassifier')
trainTask.CLASSIFIER = softmaxTask.OUTPUT_CLASSIFIER
trainTask.EXAMPLES = splitExamples[0]
trainTask.TRAINER = GDTask.OUTPUT_TRAINER
trainTask.Execute

;Evaluate the result

evaluateTask = ENVITask('EvaluateClassifier')
evaluateTask.CLASSIFIER = classifier
evaluateTask.EXAMPLES = splitExamples[1]
evaluateTask.Execute
confusionMatrix = evaluateTask.OUTPUT_CONFUSION_MATRIX

I am having an issue making these tasks loop and generating an individual result for each loop instead of iteration stacking. Is there a way to make the script generate a result for each iteration? What I am trying to do is make it run 100 times.

Robert Hijmans
  • 40,301
  • 4
  • 55
  • 63

0 Answers0