org.encog.neural.neat
Class NEATPopulation

java.lang.Object
  extended by org.encog.ml.BasicML
      extended by org.encog.ml.ea.population.BasicPopulation
          extended by org.encog.neural.neat.NEATPopulation
All Implemented Interfaces:
Serializable, Population, MLError, MLInput, MLInputOutput, MLMethod, MLOutput, MLProperties, MLRegression

public class NEATPopulation
extends BasicPopulation
implements Serializable, MLError, MLRegression

A population for a NEAT or HyperNEAT system. This population holds the genomes, substrate and other values for a NEAT or HyperNEAT network. ----------------------------------------------------------------------------- http://www.cs.ucf.edu/~kstanley/ Encog's NEAT implementation was drawn from the following three Journal Articles. For more complete BibTeX sources, see NEATNetwork.java. Evolving Neural Networks Through Augmenting Topologies Generating Large-Scale Neural Networks Through Discovering Geometric Regularities Automatic feature selection in neuroevolution

See Also:
Serialized Form

Field Summary
static int DEFAULT_CYCLES
          Default number of activation cycles.
static double DEFAULT_SURVIVAL_RATE
          The default survival rate.
static String PROPERTY_CYCLES
          Property to hold the number of cycles.
static String PROPERTY_NEAT_ACTIVATION
          The activation function to use.
static String PROPERTY_POPULATION_SIZE
          Property tag for the population size.
static String PROPERTY_SURVIVAL_RATE
          Property tag for the survival rate.
 
Constructor Summary
NEATPopulation()
          An empty constructor for serialization.
NEATPopulation(int inputCount, int outputCount, int populationSize)
          Construct a starting NEAT population.
NEATPopulation(Substrate theSubstrate, int populationSize)
          Construct a starting HyperNEAT population.
 
Method Summary
 long assignGeneID()
           
 long assignInnovationID()
           
 double calculateError(MLDataSet data)
          Calculate the error of the ML method, given a dataset.
static double clampWeight(double w, double weightRange)
          Change the weight, do not allow the weight to go out of the weight range.
 MLData compute(MLData input)
          Compute regression.
 int getActivationCycles()
           
 ChooseObject<ActivationFunction> getActivationFunctions()
           
 GeneticCODEC getCODEC()
           
 GenerateID getGeneIDGenerate()
           
 NEATGenomeFactory getGenomeFactory()
          
 double getInitialConnectionDensity()
           
 GenerateID getInnovationIDGenerate()
           
 NEATInnovationList getInnovations()
           
 int getInputCount()
          
 int getOutputCount()
          
 RandomFactory getRandomNumberFactory()
           
 Substrate getSubstrate()
           
 double getSurvivalRate()
           
 double getWeightRange()
           
 boolean isHyperNEAT()
           
 void reset()
          Create an initial random population.
 void setActivationCycles(int activationCycles)
          Set the number of activation cycles to use.
 void setCODEC(GeneticCODEC codec)
           
 void setInitialConnectionDensity(double initialConnectionDensity)
           
 void setInnovations(NEATInnovationList theInnovations)
          Set the innovation list to use.
 void setInputCount(int inputCount)
           
 void setNEATActivationFunction(ActivationFunction af)
          Specify to use a single activation function.
 void setOutputCount(int outputCount)
           
 void setRandomNumberFactory(RandomFactory randomNumberFactory)
           
 void setSubstrate(Substrate substrate)
           
 void setSurvivalRate(double theSurvivalRate)
          Set the survival rate, this is the percent of the population allowed to mate.
 
Methods inherited from class org.encog.ml.ea.population.BasicPopulation
clear, createSpecies, determineBestSpecies, flatten, getBestGenome, getMaxIndividualSize, getName, getPopulationSize, getSpecies, purgeInvalidGenomes, setBestGenome, setGenomeFactory, setName, setPopulationSize, size, updateProperties
 
Methods inherited from class org.encog.ml.BasicML
getProperties, getPropertyDouble, getPropertyLong, getPropertyString, setProperty, setProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SURVIVAL_RATE

public static final double DEFAULT_SURVIVAL_RATE
The default survival rate.

See Also:
Constant Field Values

PROPERTY_NEAT_ACTIVATION

public static final String PROPERTY_NEAT_ACTIVATION
The activation function to use.

See Also:
Constant Field Values

PROPERTY_POPULATION_SIZE

public static final String PROPERTY_POPULATION_SIZE
Property tag for the population size.

See Also:
Constant Field Values

PROPERTY_SURVIVAL_RATE

public static final String PROPERTY_SURVIVAL_RATE
Property tag for the survival rate.

See Also:
Constant Field Values

DEFAULT_CYCLES

public static final int DEFAULT_CYCLES
Default number of activation cycles.

See Also:
Constant Field Values

PROPERTY_CYCLES

public static final String PROPERTY_CYCLES
Property to hold the number of cycles.

See Also:
Constant Field Values
Constructor Detail

NEATPopulation

public NEATPopulation()
An empty constructor for serialization.


NEATPopulation

public NEATPopulation(int inputCount,
                      int outputCount,
                      int populationSize)
Construct a starting NEAT population. This does not generate the initial random population of genomes.

Parameters:
inputCount - The input neuron count.
outputCount - The output neuron count.
populationSize - The population size.

NEATPopulation

public NEATPopulation(Substrate theSubstrate,
                      int populationSize)
Construct a starting HyperNEAT population. This does not generate the initial random population of genomes.

Parameters:
theSubstrate - The substrate ID.
populationSize -
Method Detail

clampWeight

public static double clampWeight(double w,
                                 double weightRange)
Change the weight, do not allow the weight to go out of the weight range.

Parameters:
w - The amount to change the weight by.
weightRange - Specify the weight range. The range is from -weightRange to +weightRange.
Returns:
The new weight value.

assignGeneID

public long assignGeneID()
Returns:
A newly generated gene id.

assignInnovationID

public long assignInnovationID()
Returns:
A newly generated innovation id.

calculateError

public double calculateError(MLDataSet data)
Calculate the error of the ML method, given a dataset.

Specified by:
calculateError in interface MLError
Parameters:
data - The dataset.
Returns:
The error.

compute

public MLData compute(MLData input)
Compute regression.

Specified by:
compute in interface MLRegression
Parameters:
input - The input data.
Returns:
The output data.

getActivationCycles

public int getActivationCycles()
Returns:
Get the activation cycles.

getActivationFunctions

public ChooseObject<ActivationFunction> getActivationFunctions()
Returns:
the activationFunctions

getCODEC

public GeneticCODEC getCODEC()
Returns:
the codec

getGeneIDGenerate

public GenerateID getGeneIDGenerate()
Returns:
the geneIDGenerate

getGenomeFactory

public NEATGenomeFactory getGenomeFactory()

Specified by:
getGenomeFactory in interface Population
Overrides:
getGenomeFactory in class BasicPopulation
Returns:
A factory used to create genomes.

getInitialConnectionDensity

public double getInitialConnectionDensity()
Returns:
the initialConnectionDensity

getInnovationIDGenerate

public GenerateID getInnovationIDGenerate()
Returns:
the innovationIDGenerate

getInnovations

public NEATInnovationList getInnovations()
Returns:
Get the innovations.

getInputCount

public int getInputCount()

Specified by:
getInputCount in interface MLInput
Returns:
The input.

getOutputCount

public int getOutputCount()

Specified by:
getOutputCount in interface MLOutput
Returns:
The output count.

getRandomNumberFactory

public RandomFactory getRandomNumberFactory()
Returns:
the randomNumberFactory

getSubstrate

public Substrate getSubstrate()
Returns:
Returns the hyper-neat substrate.

getSurvivalRate

public double getSurvivalRate()
Returns:
The survival rate, this is the number of genomes used to mate.

getWeightRange

public double getWeightRange()
Returns:
the weightRange

isHyperNEAT

public boolean isHyperNEAT()
Returns:
Returns true if this is a hyperneat population.

reset

public void reset()
Create an initial random population.


setActivationCycles

public void setActivationCycles(int activationCycles)
Set the number of activation cycles to use.

Parameters:
activationCycles - The number of activatino cycles to use.

setCODEC

public void setCODEC(GeneticCODEC codec)
Parameters:
codec - the codec to set

setInitialConnectionDensity

public void setInitialConnectionDensity(double initialConnectionDensity)
Parameters:
initialConnectionDensity - the initialConnectionDensity to set

setInnovations

public void setInnovations(NEATInnovationList theInnovations)
Set the innovation list to use.

Parameters:
theInnovations - The innovation list to use.

setInputCount

public void setInputCount(int inputCount)
Parameters:
inputCount - the inputCount to set

setNEATActivationFunction

public void setNEATActivationFunction(ActivationFunction af)
Specify to use a single activation function. This is typically the case for NEAT, but not for HyperNEAT.

Parameters:
af - The activation function to use.

setOutputCount

public void setOutputCount(int outputCount)
Parameters:
outputCount - the outputCount to set

setRandomNumberFactory

public void setRandomNumberFactory(RandomFactory randomNumberFactory)
Parameters:
randomNumberFactory - the randomNumberFactory to set

setSubstrate

public void setSubstrate(Substrate substrate)
Parameters:
substrate - the substrate to set

setSurvivalRate

public void setSurvivalRate(double theSurvivalRate)
Set the survival rate, this is the percent of the population allowed to mate.

Parameters:
theSurvivalRate - The survival rate.


Copyright © 2014. All Rights Reserved.