mlpack  git-master

Conventional Neural Evolution (CNE) is a class of evolutionary algorithms focused on dealing with fixed topology. More...

Public Member Functions

 CNE (const size_t populationSize=500, const size_t maxGenerations=5000, const double mutationProb=0.1, const double mutationSize=0.02, const double selectPercent=0.2, const double tolerance=1e-5, const double objectiveChange=1e-5)
 Constructor for the CNE optimizer. More...

 
size_t MaxGenerations () const
 Get maximum number of generations. More...

 
size_t & MaxGenerations ()
 Modify maximum number of generations. More...

 
double MutationProbability () const
 Get the mutation probability. More...

 
double & MutationProbability ()
 Modify the mutation probability. More...

 
double MutationSize () const
 Get the mutation size. More...

 
double & MutationSize ()
 Modify the mutation size. More...

 
double ObjectiveChange () const
 Get the change in fitness history between generations. More...

 
double & ObjectiveChange ()
 Modify the termination criteria of change in fitness value. More...

 
template
<
typename
DecomposableFunctionType
>
double Optimize (DecomposableFunctionType &function, arma::mat &iterate)
 Optimize the given function using CNE. More...

 
size_t PopulationSize () const
 Get the population size. More...

 
size_t & PopulationSize ()
 Modify the population size. More...

 
double SelectionPercentage () const
 Get the selection percentage. More...

 
double & SelectionPercentage ()
 Modify the selection percentage. More...

 
double Tolerance () const
 Get the final objective value. More...

 
double & Tolerance ()
 Modify the final objective value. More...

 

Detailed Description

Conventional Neural Evolution (CNE) is a class of evolutionary algorithms focused on dealing with fixed topology.

This class implements this algorithm as an optimization technique to converge a given function to minima.

The algorithm works by creating a fixed number of candidates, with random weights. Each candidate is tested upon the training set, and a fitness score is assigned to it. Given the selection percentage of best candidates by the user, for a single generation that many percentage of candidates are selected for the next generation and the rest are removed The selected candidates for a particular generation then become the parents for the next generation and evolution takes place.

The evolution process basically takes place in two types:

  • Crossover
  • Mutation

Crossover takes two parents and generates two children from them. Both the children have properties inherited by their parents. The parameters of the parents are mixed using equal probability selection, creating two children. This is just a mix of link weights or the parameters.

In mutation parameters are updated by pertubating small noise. If $ \Lambda $ is the number of weights in the network.

\[ \sum_{n=1}^{\Lambda}\omega_n = \omega_n + \rho, \]

where $ \rho $ is the small pertubation value determined randomly between 0 and the mutation size given by the user as a constructor parameter. Also the mutation probability taken as a constructor parameter decides the amount of mutation addition into the network.

Both the above mentioned processes create new candidates as well as change the existing candidates to obtain better candidates in the next generation.

The whole process then repeats for multiple generation until at least one of the termination criteria is met:

1) The final value of the objective function (Not considered if not provided). 2) The maximum number of generation reached (optional but highly recommended). 3) Minimum change in best fitness values between two consecutive generations should be greater than a threshold value (Not considered if not provided).

The final value and the parameters are returned by the Optimize() method.

For CNE to work, a FunctionType template parameter is required. This class must implement the following function:

double Evaluate(const arma::mat& iterate);

Definition at line 74 of file cne.hpp.

Constructor & Destructor Documentation

◆ CNE()

CNE ( const size_t  populationSize = 500,
const size_t  maxGenerations = 5000,
const double  mutationProb = 0.1,
const double  mutationSize = 0.02,
const double  selectPercent = 0.2,
const double  tolerance = 1e-5,
const double  objectiveChange = 1e-5 
)

Constructor for the CNE optimizer.

The default values provided over here are not necessarily suitable for a given function. Therefore it is highly recommended to adjust the parameters according to the problem.

Parameters
populationSizeThe number of candidates in the population. This should be at least 4 in size.
maxGenerationsThe maximum number of generations allowed for CNE.
mutationProbProbability that a weight will get mutated.
mutationSizeThe range of mutation noise to be added. This range is between 0 and mutationSize.
selectPercentThe percentage of candidates to select to become the the next generation.
toleranceThe final value of the objective function for termination. If set to negative value, tolerance is not considered.
objectiveChangeMinimum change in best fitness values between two consecutive generations should be greater than threshold. If set to negative value, objectiveChange is not considered.

Member Function Documentation

◆ MaxGenerations() [1/2]

size_t MaxGenerations ( ) const
inline

Get maximum number of generations.

Definition at line 125 of file cne.hpp.

◆ MaxGenerations() [2/2]

size_t& MaxGenerations ( )
inline

Modify maximum number of generations.

Definition at line 127 of file cne.hpp.

◆ MutationProbability() [1/2]

double MutationProbability ( ) const
inline

Get the mutation probability.

Definition at line 130 of file cne.hpp.

◆ MutationProbability() [2/2]

double& MutationProbability ( )
inline

Modify the mutation probability.

Definition at line 132 of file cne.hpp.

◆ MutationSize() [1/2]

double MutationSize ( ) const
inline

Get the mutation size.

Definition at line 135 of file cne.hpp.

◆ MutationSize() [2/2]

double& MutationSize ( )
inline

Modify the mutation size.

Definition at line 137 of file cne.hpp.

◆ ObjectiveChange() [1/2]

double ObjectiveChange ( ) const
inline

Get the change in fitness history between generations.

Definition at line 150 of file cne.hpp.

◆ ObjectiveChange() [2/2]

double& ObjectiveChange ( )
inline

Modify the termination criteria of change in fitness value.

Definition at line 152 of file cne.hpp.

◆ Optimize()

double Optimize ( DecomposableFunctionType &  function,
arma::mat &  iterate 
)

Optimize the given function using CNE.

The given starting point will be modified to store the finishing point of the algorithm, and the final objective value is returned.

Template Parameters
DecomposableFunctionTypeType of the function to be optimized.
Parameters
functionFunction to optimize.
iterateStarting point (will be modified).
Returns
Objective value of the final point.

◆ PopulationSize() [1/2]

size_t PopulationSize ( ) const
inline

Get the population size.

Definition at line 120 of file cne.hpp.

◆ PopulationSize() [2/2]

size_t& PopulationSize ( )
inline

Modify the population size.

Definition at line 122 of file cne.hpp.

◆ SelectionPercentage() [1/2]

double SelectionPercentage ( ) const
inline

Get the selection percentage.

Definition at line 140 of file cne.hpp.

◆ SelectionPercentage() [2/2]

double& SelectionPercentage ( )
inline

Modify the selection percentage.

Definition at line 142 of file cne.hpp.

◆ Tolerance() [1/2]

double Tolerance ( ) const
inline

Get the final objective value.

Definition at line 145 of file cne.hpp.

◆ Tolerance() [2/2]

double& Tolerance ( )
inline

Modify the final objective value.

Definition at line 147 of file cne.hpp.


The documentation for this class was generated from the following file:
  • src/mlpack/core/optimizers/cne/cne.hpp