The Encog Project

org.encog.neural.networks.training.propagation.gradient
Class GradientWorker

java.lang.Object
  extended by org.encog.neural.networks.training.propagation.gradient.GradientWorker
All Implemented Interfaces:
java.lang.Runnable

public class GradientWorker
extends java.lang.Object
implements java.lang.Runnable

A worker handles one thread. Used to allow the gradient calculation process to run multithreaded. Even if running in single threaded mode, a single worker is created and run by the main thread.


Constructor Summary
GradientWorker(CalculateGradient owner, NeuralDataSet training, int low, int high)
          Construct a worker.
 
Method Summary
 int getCount()
           
 double getError()
           
 double[] getErrors()
           
 BasicNetwork getNetwork()
           
 void run()
          The main loop for this thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GradientWorker

public GradientWorker(CalculateGradient owner,
                      NeuralDataSet training,
                      int low,
                      int high)
Construct a worker.

Parameters:
owner - The owner of this worker.
training - The training set that this worker is to use.
low - The low element in the training set.
high - The high element in the training set.
Method Detail

getCount

public int getCount()
Returns:
The number of training elements ot be processed by this worker.

getError

public double getError()
Returns:
The overall error for this worker.

getErrors

public double[] getErrors()
Returns:
The gradients calculated for this worker.

getNetwork

public BasicNetwork getNetwork()
Returns:
The network to calculate gradients for.

run

public void run()
The main loop for this thread.

Specified by:
run in interface java.lang.Runnable

The Encog Project