GestureRecognitionToolkit  Version: 0.1.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
EvolutionaryAlgorithm< INDIVIDUAL > Class Template Reference
Inheritance diagram for EvolutionaryAlgorithm< INDIVIDUAL >:
GRTBase

Public Member Functions

 EvolutionaryAlgorithm (const UINT populationSize=0, const UINT geneSize=0)
 
virtual ~EvolutionaryAlgorithm ()
 
INDIVIDUAL & operator[] (const UINT &index)
 
virtual bool initPopulation (const UINT populationSize, const UINT geneSize)
 
virtual bool estimatePopulationFitness (const MatrixFloat &trainingData, Float &bestFitness, UINT &bestIndex)
 
virtual bool evolvePopulation ()
 
virtual Float evaluateFitness (INDIVIDUAL &individual, const MatrixFloat &trainingData)
 
virtual bool train (const MatrixFloat &trainingData)
 
UINT getPopulationSize () const
 
bool getInitialized () const
 
Vector< INDIVIDUAL > getPopulation () const
 
bool setPopulationSize (const UINT populationSize)
 
bool setMinNumIterationsNoChange (const UINT minNumIterationsNoChange)
 
bool setMaxIterations (const UINT maxIteration)
 
bool setStoreRate (const UINT storeRate)
 
bool setStoreHistory (const bool storeHistory)
 
bool setBaiseWeights (const bool baiseWeights)
 
bool setBaiseCoeff (const Float baiseCoeff)
 
bool setMutationRate (const Float mutationRate)
 
bool setMinChange (const Float minChange)
 
virtual bool setPopulation (const Vector< INDIVIDUAL > &newPopulation)
 
virtual Float generateRandomGeneValue ()
 
virtual bool customConvergenceCheck ()
 
virtual bool printBest () const
 
- Public Member Functions inherited from GRTBase
 GRTBase (void)
 
virtual ~GRTBase (void)
 
bool copyGRTBaseVariables (const GRTBase *GRTBase)
 
std::string getClassType () const
 
std::string getLastWarningMessage () const
 
std::string getLastErrorMessage () const
 
std::string getLastInfoMessage () const
 
bool setInfoLoggingEnabled (const bool loggingEnabled)
 
bool setWarningLoggingEnabled (const bool loggingEnabled)
 
bool setErrorLoggingEnabled (const bool loggingEnabled)
 
GRTBasegetGRTBasePointer ()
 
const GRTBasegetGRTBasePointer () const
 

Public Attributes

bool initialized
 
bool useElitism
 
bool storeHistory
 
bool baiseWeights
 
UINT populationSize
 
UINT geneSize
 
UINT minNumIterationsNoChange
 
UINT maxIteration
 
UINT storeRate
 
UINT bestIndividualIndex
 
Float bestIndividualFitness
 
Float mutationRate
 
Float minChange
 
Float baiseCoeff
 
Random rand
 
Vector< INDIVIDUAL > population
 
Vector< INDIVIDUAL > parents
 
Vector< IndexedDoublepopulationWeights
 
Vector< Vector< INDIVIDUAL > > populationHistory
 
Vector< IndexedDoublefitnessHistory
 
VectorFloat accumSumLookup
 

Additional Inherited Members

- Static Public Member Functions inherited from GRTBase
static std::string getGRTVersion (bool returnRevision=true)
 
static std::string getGRTRevison ()
 
- Protected Member Functions inherited from GRTBase
Float SQR (const Float &x) const
 
- Protected Attributes inherited from GRTBase
std::string classType
 
DebugLog debugLog
 
ErrorLog errorLog
 
InfoLog infoLog
 
TrainingLog trainingLog
 
TestingLog testingLog
 
WarningLog warningLog
 

Detailed Description

template<typename INDIVIDUAL>
class EvolutionaryAlgorithm< INDIVIDUAL >

Definition at line 41 of file EvolutionaryAlgorithm.h.

Constructor & Destructor Documentation

template<typename INDIVIDUAL >
EvolutionaryAlgorithm< INDIVIDUAL >::EvolutionaryAlgorithm ( const UINT  populationSize = 0,
const UINT  geneSize = 0 
)
inline

Default Constructor, if the populationSize and geneSize parameters are greater than zero then the algorithm will be initialized.

Parameters
populationSizethe number of individuals in the population. Default value = 0
geneSizethe number of elements in each individuals gene. Default value = 0

Definition at line 51 of file EvolutionaryAlgorithm.h.

template<typename INDIVIDUAL >
virtual EvolutionaryAlgorithm< INDIVIDUAL >::~EvolutionaryAlgorithm ( )
inlinevirtual

Default Destructor.

Definition at line 75 of file EvolutionaryAlgorithm.h.

Member Function Documentation

template<typename INDIVIDUAL >
virtual bool EvolutionaryAlgorithm< INDIVIDUAL >::estimatePopulationFitness ( const MatrixFloat trainingData,
Float &  bestFitness,
UINT &  bestIndex 
)
inlinevirtual

This function estimates the populations fitness, based on the training data. It will return a reference to the bestFitness value and the index of the individual with the best fitness.

Parameters
trainingDataa reference to the trainingData that will be used to estimate the fitness
bestFitnessa reference that will return the best fitness value
bestIndexa reference that will return the index of the individual with the best fitness
Returns
returns true if the population fitness was estimated, false otherwise

Definition at line 160 of file EvolutionaryAlgorithm.h.

template<typename INDIVIDUAL >
virtual Float EvolutionaryAlgorithm< INDIVIDUAL >::evaluateFitness ( INDIVIDUAL &  individual,
const MatrixFloat trainingData 
)
inlinevirtual

This function evaluates the fitness of an individual, using the training data. This function assumes that each row in the training data is an example, each column must therefore match the geneSize.

Parameters
individuala reference to the individual you want to compute the fitness for
trainingDataa reference to the training data that will be used to compute the individual's fitness
Returns
returns the fitness of the individual

Definition at line 307 of file EvolutionaryAlgorithm.h.

template<typename INDIVIDUAL >
virtual bool EvolutionaryAlgorithm< INDIVIDUAL >::evolvePopulation ( )
inlinevirtual

This function evolves the current population, based on the fitness of each individual. You should compute the fitness of each individual first before using this function.

Returns
returns true if the population was evolved, false otherwise

Definition at line 196 of file EvolutionaryAlgorithm.h.

template<typename INDIVIDUAL >
virtual bool EvolutionaryAlgorithm< INDIVIDUAL >::initPopulation ( const UINT  populationSize,
const UINT  geneSize 
)
inlinevirtual

This function initalizes the population, setting each individual's genes to a random value in the range [0.0 1.0]. Both the populationSize and geneSize parameters must be greater than zero.

Parameters
populationSizethe number of individuals in the population
geneSizethe number of elements in each individuals gene
Returns
returns true if the population was initalized, false otherwise

Definition at line 98 of file EvolutionaryAlgorithm.h.

template<typename INDIVIDUAL >
INDIVIDUAL& EvolutionaryAlgorithm< INDIVIDUAL >::operator[] ( const UINT &  index)
inline

This operator allows you to directly access each individual in the population. The user must ensure that index is a valid number in the range of [0 populationSize-1].

Parameters
indexthe index of the individual you want to access
Returns
returns a reference to the individual in the population at the specific index

Definition at line 86 of file EvolutionaryAlgorithm.h.


The documentation for this class was generated from the following file: