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... | |
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 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
is the number of weights in the network.
where
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);
| 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.
| populationSize | The number of candidates in the population. This should be at least 4 in size. |
| maxGenerations | The maximum number of generations allowed for CNE. |
| mutationProb | Probability that a weight will get mutated. |
| mutationSize | The range of mutation noise to be added. This range is between 0 and mutationSize. |
| selectPercent | The percentage of candidates to select to become the the next generation. |
| tolerance | The final value of the objective function for termination. If set to negative value, tolerance is not considered. |
| objectiveChange | Minimum change in best fitness values between two consecutive generations should be greater than threshold. If set to negative value, objectiveChange is not considered. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| 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.
| DecomposableFunctionType | Type of the function to be optimized. |
| function | Function to optimize. |
| iterate | Starting point (will be modified). |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |