public class MLMethodGeneticAlgorithmextends BasicTrainingimplements MultiThreadableImplements a genetic algorithm that allows an MLMethod that is encodable (MLEncodable) to be trained. It works well with both BasicNetwork and FreeformNetwork class, as well as any MLEncodable class. 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
Nested Classes Modifier and Type Class and Description
MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelperVery simple class that implements a genetic algorithm.
Constructors Constructor and Description
MLMethodGeneticAlgorithm(MethodFactory phenotypeFactory, CalculateScore calculateScore, int populationSize)Construct a method genetic algorithm.
Methods Modifier and Type Method and Description
getMethod()Get the current best machine learning method from the training.
iteration()Perform one training iteration.
pause()Pause the training to continue later.
resume(TrainingContinuation state)Resume training.
setGenetic(MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper genetic)Set the genetic helper class.
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
public MLMethodGeneticAlgorithm(MethodFactory phenotypeFactory, CalculateScore calculateScore, int populationSize)Construct a method genetic algorithm.
phenotypeFactory- The phenotype factory.
calculateScore- The score calculation object.
populationSize- The population size.
public boolean canContinue()
public MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper getGenetic()
- The genetic algorithm implementation.
public MLMethod getMethod()Get the current best machine learning method from the training.
public int getThreadCount()
public void iteration()Perform one training iteration.
public TrainingContinuation pause()Pause the training to continue later.
public void resume(TrainingContinuation state)Resume training.
public void setGenetic(MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper genetic)Set the genetic helper class.
genetic- The genetic helper class.
public void setThreadCount(int numThreads)Description copied from interface:
MultiThreadableSet the number of threads to use.
SCaVis 1.7 © jWork.org