Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.encog.neural.networks.training.genetic
Class NeuralGeneticAlgorithm

    java.lang.Object
      org.encog.ml.train.BasicTraining
          org.encog.neural.networks.training.genetic.NeuralGeneticAlgorithm

All Implemented Interfaces:
  MLTrain, MultiThreadable

    public class NeuralGeneticAlgorithm

extends BasicTraining
implements MultiThreadable

Implements a genetic algorithm that allows a feedforward or simple recurrent neural network to be trained using a genetic algorithm. There are essentially two ways you can make use of this class. Either way, you will need a score object. The score object tells the genetic algorithm how well suited a neural network is. If you would like to use genetic algorithms with a training set you should make use TrainingSetScore class. This score object uses a training set to score your neural network. If you would like to be more abstract, and not use a training set, you can create your own implementation of the CalculateScore method. This class can then score the networks any way that you like.

Nested Class Summary
`class` | `NeuralGeneticAlgorithm.NeuralGeneticAlgorithmHelper` Very simple class that implements a genetic algorithm.

Constructor Summary
`NeuralGeneticAlgorithm(BasicNetwork network, Randomizer randomizer, CalculateScore calculateScore, int populationSize, double mutationPercent, double percentToMate)` Construct a neural genetic algorithm.

Method Summary
`boolean` | `canContinue()`
`NeuralGeneticAlgorithm.NeuralGeneticAlgorithmHelper` | `getGenetic()`
`MLMethod` | `getMethod()` Get the current best machine learning method from the training.
`int` | `getThreadCount()`
`void` | `iteration()` Perform one training iteration.
`TrainingContinuation` | `pause()` Pause the training to continue later.
`void` | `resume(TrainingContinuation state)` Resume training.
`void` | `setGenetic(NeuralGeneticAlgorithm.NeuralGeneticAlgorithmHelper genetic)` Set the genetic helper class.
`void` | `setThreadCount(int numThreads)` Set the number of threads to use.

Methods inherited from class org.encog.ml.train.BasicTraining
`addStrategy, finishTraining, getError, getImplementationType, getIteration, getStrategies, getTraining, isTrainingDone, iteration, postIteration, preIteration, setError, setIteration, setTraining`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NeuralGeneticAlgorithm

    public NeuralGeneticAlgorithm(BasicNetwork network,
                                  Randomizer randomizer,
                                  CalculateScore calculateScore,
                                  int populationSize,
                                  double mutationPercent,
                                  double percentToMate)

  Construct a neural genetic algorithm.

  Parameters:
    `network` - The network to base this on.
    `randomizer` - The randomizer used to create this initial population.
    `calculateScore` - The score calculation object.
    `populationSize` - The population size.
    `mutationPercent` - The percent of offspring to mutate.
    `percentToMate` - The percent of the population allowed to mate.

Method Detail

### canContinue

    public final boolean canContinue()

  Specified by:
    `canContinue` in interface `MLTrain`
  Returns:
    True if the training can be paused, and later continued.

### getGenetic

    public final NeuralGeneticAlgorithm.NeuralGeneticAlgorithmHelper getGenetic()

  Returns:
    The genetic algorithm implementation.

### getMethod

    public final MLMethod getMethod()

  Get the current best machine learning method from the training.

  Specified by:
    `getMethod` in interface `MLTrain`
  Returns:
    The best machine learningm method.

### iteration

    public final void iteration()

  Perform one training iteration.

  Specified by:
    `iteration` in interface `MLTrain`

### pause

    public final TrainingContinuation pause()

  Pause the training to continue later.

  Specified by:
    `pause` in interface `MLTrain`
  Returns:
    A training continuation object.

### resume

    public final void resume(TrainingContinuation state)

  Resume training.

  Specified by:
    `resume` in interface `MLTrain`
  Parameters:
    `state` - The training continuation object to use to continue.

### setGenetic

    public final void setGenetic(NeuralGeneticAlgorithm.NeuralGeneticAlgorithmHelper genetic)

  Set the genetic helper class.

  Parameters:
    `genetic` - The genetic helper class.

### getThreadCount

    public int getThreadCount()

  Specified by:
    `getThreadCount` in interface `MultiThreadable`
  Returns:
    The number of threads to use, 0 to automatically determine based on core count.

### setThreadCount

    public void setThreadCount(int numThreads)

  Description copied from interface: `MultiThreadable`
  Set the number of threads to use.

  Specified by:
    `setThreadCount` in interface `MultiThreadable`
  Parameters:
    `numThreads` - The number of threads to use, or zero to automatically determine based on core count.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.