GestureRecognitionToolkit  Version: 1.0 Revision: 04-03-15
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
GRT::EvolutionaryAlgorithm< INDIVIDUAL > Class Template Reference
Inheritance diagram for GRT::EvolutionaryAlgorithm< INDIVIDUAL >:
GRT::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 MatrixDouble &trainingData, double &bestFitness, UINT &bestIndex)
 
virtual bool evolvePopulation ()
 
virtual double evaluateFitness (INDIVIDUAL &individual, const MatrixDouble &trainingData)
 
virtual bool train (const MatrixDouble &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 double baiseCoeff)
 
bool setMutationRate (const double mutationRate)
 
bool setMinChange (const double minChange)
 
virtual bool setPopulation (const vector< INDIVIDUAL > &newPopulation)
 
virtual double generateRandomGeneValue ()
 
virtual bool customConvergenceCheck ()
 
virtual bool printBest () const
 
- Public Member Functions inherited from GRT::GRTBase
 GRTBase (void)
 
virtual ~GRTBase (void)
 
bool copyGRTBaseVariables (const GRTBase *GRTBase)
 
string getClassType () const
 
string getLastWarningMessage () const
 
string getLastErrorMessage () const
 
string getLastInfoMessage () const
 
GRTBasegetGRTBasePointer ()
 
const GRTBasegetGRTBasePointer () const
 

Public Attributes

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

Additional Inherited Members

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

Detailed Description

template<typename INDIVIDUAL>
class GRT::EvolutionaryAlgorithm< INDIVIDUAL >

Definition at line 41 of file EvolutionaryAlgorithm.h.

Constructor & Destructor Documentation

template<typename INDIVIDUAL >
GRT::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
constUINT populationSize: the number of individuals in the population. Default value = 0
constUINT geneSize: the number of elements in each individuals gene. Default value = 0

Definition at line 51 of file EvolutionaryAlgorithm.h.

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

Default Destructor.

Definition at line 75 of file EvolutionaryAlgorithm.h.

Member Function Documentation

template<typename INDIVIDUAL >
virtual bool GRT::EvolutionaryAlgorithm< INDIVIDUAL >::estimatePopulationFitness ( const MatrixDouble trainingData,
double &  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
constMatrixDouble &trainingData: a reference to the trainingData that will be used to estimate the fitness
double&bestFitness: a reference that will return the best fitness value
UINT&bestIndex: a 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 double GRT::EvolutionaryAlgorithm< INDIVIDUAL >::evaluateFitness ( INDIVIDUAL &  individual,
const MatrixDouble 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
INDIVIDUAL&individual: a reference to the individual you want to compute the fitness for
constMatrixDouble &trainingData: a 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 GRT::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 GRT::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
constUINT populationSize: the number of individuals in the population
constUINT geneSize: the 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& GRT::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
constUINT index: the 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: