public class MLMethodGeneticAlgorithm extends BasicTraining implements MultiThreadable
| Modifier and Type | Class and Description |
|---|---|
class |
MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper
Very simple class that implements a genetic algorithm.
|
| Constructor and Description |
|---|
MLMethodGeneticAlgorithm(MethodFactory phenotypeFactory,
CalculateScore calculateScore,
int populationSize)
Construct a method genetic algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canContinue() |
void |
finishTraining()
Should be called after training has completed and the iteration method
will not be called any further.
|
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.
|
addStrategy, getError, getImplementationType, getIteration, getStrategies, getTraining, isTrainingDone, iteration, postIteration, preIteration, setError, setIteration, setTrainingpublic MLMethodGeneticAlgorithm(MethodFactory phenotypeFactory, CalculateScore calculateScore, int populationSize)
phenotypeFactory - The phenotype factory.calculateScore - The score calculation object.populationSize - The population size.public boolean canContinue()
canContinue in interface MLTrainpublic MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper getGenetic()
public MLMethod getMethod()
public int getThreadCount()
getThreadCount in interface MultiThreadablepublic void iteration()
public TrainingContinuation pause()
public void resume(TrainingContinuation state)
public void finishTraining()
BasicTrainingfinishTraining in interface MLTrainfinishTraining in class BasicTrainingpublic void setGenetic(MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper genetic)
genetic - The genetic helper class.public void setThreadCount(int numThreads)
MultiThreadablesetThreadCount in interface MultiThreadablenumThreads - The number of threads to use, or zero to
automatically determine based on core count.