This module can be used to solve optimization tasks. For instance, you could use this module to tune the hyper-parameters of a neural network or a decision tree.
To install the package, simply run:
git clone https://github.com/sachahu1/Evolutionary_Optimization
cd Evolutionary_Optimization
Then, set up a virtual environment like so:
python3 -m venv ./venv
Activate your virtual environment:
source venv/bin/activate
And install the dependencies:
pip3 install -r requirements.txt
First go to the right directory:
cd Evolutionary_Optimization/src
Then, run the code as follows:
python3 train_ea.py
You can easily configure your own optimization problem through the Evolutionary_Optimization/src/config.py
file.
To do so, simply follow these steps:
- Write your own test function which evaluates an individual's genotype into a phenotype (see these examples).
- Write your own fitness function which evaluates an individual's phenotype and returns a fitness score (see these examples).
- Define your own genotype in the format of a python Dict with the minimum and maximum values
- Configure the parameters of your experiment
You're all set and ready to solve your optimization problem!
Below are a few examples of an evolutionary optimization task being solved. In these examples, the black dot represents the best individual in the population and the cross represents the worst individual.
You can consult our documentation here.