MLMethodGeneticAlgorithm
org.encog.ml.genetic

Class MLMethodGeneticAlgorithm

  • All Implemented Interfaces:
    MLTrain, MultiThreadable


    public class MLMethodGeneticAlgorithmextends BasicTrainingimplements MultiThreadable
    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.
    • Constructor Detail

      • MLMethodGeneticAlgorithm

        public MLMethodGeneticAlgorithm(MethodFactory phenotypeFactory,                        CalculateScore calculateScore,                        int populationSize)
        Construct a method genetic algorithm.
        Parameters:
        phenotypeFactory - The phenotype factory.
        calculateScore - The score calculation object.
        populationSize - The population size.
    • Method Detail

      • canContinue

        public boolean canContinue()
        Specified by:
        canContinue in interface MLTrain
        Returns:
        True if the training can be paused, and later continued.
      • getMethod

        public MLMethod getMethod()
        Get the current best machine learning method from the training.
        Specified by:
        getMethod in interface MLTrain
        Returns:
        The best machine learningm method.
      • 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.
      • iteration

        public void iteration()
        Perform one training iteration.
        Specified by:
        iteration in interface MLTrain
      • resume

        public void resume(TrainingContinuation state)
        Resume training.
        Specified by:
        resume in interface MLTrain
        Parameters:
        state - The training continuation object to use to continue.
      • 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.

SCaVis 2.0 © jWork.ORG