org.encog.neural.neat
Class NEATPopulation
- java.lang.Object
-
- org.encog.ml.BasicML
-
- org.encog.ml.ea.population.BasicPopulation
-
- org.encog.neural.neat.NEATPopulation
-
- All Implemented Interfaces:
- java.io.Serializable, Population, MLError, MLInput, MLInputOutput, MLMethod, MLOutput, MLProperties, MLRegression
public class NEATPopulation extends BasicPopulation implements java.io.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
Fields Modifier and Type Field and Description static intDEFAULT_CYCLESDefault number of activation cycles.static doubleDEFAULT_HYPERNEAT_WEIGHT_RANGEDefault link weight range for HyperNEAT networks.static doubleDEFAULT_NEAT_WEIGHT_RANGEDefault link weight range for NEAT networks.static doubleDEFAULT_SURVIVAL_RATEThe default survival rate.static java.lang.StringPROPERTY_CYCLESProperty to hold the number of cycles.static java.lang.StringPROPERTY_NEAT_ACTIVATIONThe activation function to use.static java.lang.StringPROPERTY_POPULATION_SIZEProperty tag for the population size.static java.lang.StringPROPERTY_SURVIVAL_RATEProperty tag for the survival rate.
-
Constructor Summary
Constructors Constructor and Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description longassignGeneID()longassignInnovationID()doublecalculateError(MLDataSet data)Calculate the error of the ML method, given a dataset.static doubleclampWeight(double w, double weightRange)Change the weight, do not allow the weight to go out of the weight range.MLDatacompute(MLData input)Compute regression.intgetActivationCycles()ChooseObject<ActivationFunction>getActivationFunctions()GeneticCODECgetCODEC()GenerateIDgetGeneIDGenerate()NEATGenomeFactorygetGenomeFactory()doublegetInitialConnectionDensity()GenerateIDgetInnovationIDGenerate()NEATInnovationListgetInnovations()intgetInputCount()intgetOutputCount()RandomFactorygetRandomNumberFactory()SubstrategetSubstrate()doublegetSurvivalRate()doublegetWeightRange()booleanisHyperNEAT()voidreset()Create an initial random population.voidsetActivationCycles(int activationCycles)Set the number of activation cycles to use.voidsetCODEC(GeneticCODEC codec)voidsetInitialConnectionDensity(double initialConnectionDensity)voidsetInnovations(NEATInnovationList theInnovations)Set the innovation list to use.voidsetInputCount(int inputCount)voidsetNEATActivationFunction(ActivationFunction af)Specify to use a single activation function.voidsetOutputCount(int outputCount)voidsetRandomNumberFactory(RandomFactory randomNumberFactory)voidsetSubstrate(Substrate substrate)voidsetSurvivalRate(double theSurvivalRate)Set the survival rate, this is the percent of the population allowed to mate.voidsetWeightRange(double weightRange)Sets the weight range for links in genomes in this population.-
Methods inherited from class org.encog.ml.ea.population.BasicPopulation
clear, createSpecies, determineBestSpecies, flatten, getBestGenome, getMaxIndividualSize, getName, getPopulationSize, getRules, getSpecies, purgeInvalidGenomes, setBestGenome, setGenomeFactory, setName, setPopulationSize, setRules, size, updateProperties
-
Methods inherited from class org.encog.ml.BasicML
getProperties, getPropertyDouble, getPropertyLong, getPropertyString, setProperty, setProperty, setProperty
-
-
-
-
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 java.lang.String PROPERTY_NEAT_ACTIVATION
The activation function to use.- See Also:
- Constant Field Values
-
PROPERTY_POPULATION_SIZE
public static final java.lang.String PROPERTY_POPULATION_SIZE
Property tag for the population size.- See Also:
- Constant Field Values
-
PROPERTY_SURVIVAL_RATE
public static final java.lang.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 java.lang.String PROPERTY_CYCLES
Property to hold the number of cycles.- See Also:
- Constant Field Values
-
DEFAULT_NEAT_WEIGHT_RANGE
public static final double DEFAULT_NEAT_WEIGHT_RANGE
Default link weight range for NEAT networks.- See Also:
- Constant Field Values
-
DEFAULT_HYPERNEAT_WEIGHT_RANGE
public static final double DEFAULT_HYPERNEAT_WEIGHT_RANGE
Default link weight range for HyperNEAT networks.- 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- The population size.
-
-
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:
calculateErrorin interfaceMLError- Parameters:
data- The dataset.- Returns:
- The error.
-
compute
public MLData compute(MLData input)
Compute regression.- Specified by:
computein interfaceMLRegression- 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:
getGenomeFactoryin interfacePopulation- Overrides:
getGenomeFactoryin classBasicPopulation- 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:
getInputCountin interfaceMLInput- Returns:
- The input.
-
getOutputCount
public int getOutputCount()
- Specified by:
getOutputCountin interfaceMLOutput- 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.
-
setWeightRange
public void setWeightRange(double weightRange)
Sets the weight range for links in genomes in this population.- Parameters:
weightRange- The link weight range.
-
-
DMelt 3.0 © DataMelt by jWork.ORG