The Encog Project

org.encog.neural.prune
Class PruneIncremental

java.lang.Object
  extended by org.encog.util.concurrency.job.ConcurrentJob
      extended by org.encog.neural.prune.PruneIncremental

public class PruneIncremental
extends ConcurrentJob

This class is used to help determine the optimal configuration for the hidden layers of a neural network. It can accept a pattern, which specifies the type of neural network to create, and a list of the maximum and minimum hidden layer neurons. It will then attempt to train the neural network at all configurations and see which hidden neuron counts work the best.

Author:
jheaton

Constructor Summary
PruneIncremental(NeuralDataSet training, NeuralNetworkPattern pattern, int iterations, StatusReportable report)
          Construct an object to determine the optimal number of hidden layers and neurons for the specified training data and pattern.
 
Method Summary
 void addHiddenLayer(int min, int max)
          Add a hidden layer's min and max.
 BasicNetwork getBestNetwork()
           
 java.util.List<HiddenLayerParams> getHidden()
           
 int getIterations()
           
 NeuralNetworkPattern getPattern()
           
 NeuralDataSet getTraining()
           
 int loadWorkload()
          Get the next workload.
static java.lang.String networkToString(BasicNetwork network)
          Format the network as a human readable string that lists the hidden layers.
 void performJobUnit(JobUnitContext context)
          Perform an individual job unit, which is a single network to train and evaluate.
 void process()
          Begin the prune process.
 java.lang.Object requestNextTask()
          Request the next task.
 
Methods inherited from class org.encog.util.concurrency.job.ConcurrentJob
reportStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PruneIncremental

public PruneIncremental(NeuralDataSet training,
                        NeuralNetworkPattern pattern,
                        int iterations,
                        StatusReportable report)
Construct an object to determine the optimal number of hidden layers and neurons for the specified training data and pattern.

Parameters:
training - The training data to use.
pattern - The network pattern to use to solve this data.
iterations - How many iterations to try per network.
report - Object used to report status to.
Method Detail

networkToString

public static java.lang.String networkToString(BasicNetwork network)
Format the network as a human readable string that lists the hidden layers.

Parameters:
network - The network to format.
Returns:
A human readable string.

addHiddenLayer

public void addHiddenLayer(int min,
                           int max)
Add a hidden layer's min and max. Call this once per hidden layer. Specify a zero min if it is possible to remove this hidden layer.

Parameters:
min - The minimum number of neurons for this layer.
max - The maximum number of neurons for this layer.

getBestNetwork

public BasicNetwork getBestNetwork()
Returns:
The network being processed.

getHidden

public java.util.List<HiddenLayerParams> getHidden()
Returns:
The hidden layer max and min.

getIterations

public int getIterations()
Returns:
The number of training iterations to try for each network.

getPattern

public NeuralNetworkPattern getPattern()
Returns:
The network pattern to use.

getTraining

public NeuralDataSet getTraining()
Returns:
The training set to use.

loadWorkload

public int loadWorkload()
Get the next workload. This is the number of hidden neurons. This is the total amount of work to be processed.

Specified by:
loadWorkload in class ConcurrentJob
Returns:
The amount of work to be processed by this.

performJobUnit

public void performJobUnit(JobUnitContext context)
Perform an individual job unit, which is a single network to train and evaluate.

Specified by:
performJobUnit in class ConcurrentJob
Parameters:
context - Contains information about the job unit.

process

public void process()
Begin the prune process.

Overrides:
process in class ConcurrentJob

requestNextTask

public java.lang.Object requestNextTask()
Request the next task. This is the next network to attempt to train.

Specified by:
requestNextTask in class ConcurrentJob
Returns:
The next network to train.

The Encog Project