|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.encog.ml.train.BasicTraining
org.encog.ml.genetic.MLMethodGeneticAlgorithm
public class MLMethodGeneticAlgorithm
Implements 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 | |
---|---|
class |
MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper
Very simple class that implements a genetic algorithm. |
Constructor Summary | |
---|---|
MLMethodGeneticAlgorithm(MethodFactory phenotypeFactory,
CalculateScore calculateScore,
int populationSize)
Construct a method genetic algorithm. |
Method Summary | |
---|---|
boolean |
canContinue()
|
MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper |
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(MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper 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 |
---|
public MLMethodGeneticAlgorithm(MethodFactory phenotypeFactory, CalculateScore calculateScore, int populationSize)
phenotypeFactory
- The phenotype factory.calculateScore
- The score calculation object.populationSize
- The population size.Method Detail |
---|
public boolean canContinue()
canContinue
in interface MLTrain
public MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper getGenetic()
public MLMethod getMethod()
getMethod
in interface MLTrain
public int getThreadCount()
getThreadCount
in interface MultiThreadable
public void iteration()
iteration
in interface MLTrain
public TrainingContinuation pause()
pause
in interface MLTrain
public void resume(TrainingContinuation state)
resume
in interface MLTrain
state
- The training continuation object to use to continue.public void setGenetic(MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper genetic)
genetic
- The genetic helper class.public void setThreadCount(int numThreads)
MultiThreadable
setThreadCount
in interface MultiThreadable
numThreads
- The number of threads to use, or zero to
automatically determine based on core count.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |