Genetic Algorithms - lorenzodelmedico/AI-knowledge GitHub Wiki

Heuristic search algorithm and optimization algorithm. Inspired by Charles Darwin's theory, natural evolution.

Commonly used in :

  • Feature selection: To find the best subset of features for a given machine learning model.
  • Hyperparameter optimization: To find the best hyperparameters for a machine learning model.
  • Neural network training: To train neural networks with complex architectures.
  • Clustering: To divide a data set into different groups based on similarities.
  • Pattern recognition: To identify patterns in data.
  • Optimization problems: To find the global optimum for problems such as the traveling salesman problem or the knapsack problem.
  • Scheduling problems: To find the best schedule for tasks such as resource allocation or job scheduling.

How does it work:

A genetic algorithm always start with a population, and then goes on a process where the fittest will be selected, produced offspring which become the new generation until convergence. It relies on 5 main phase :

  1. Initial population
  2. Fitness function
  3. Selection process
  4. Crossover
  5. Mutation

Workflow:

workflow_genetic_algorithm

Initial population:

Generate initial population that consist of all the probable solutions. Binary strings are often used here.

Fitness: Score computing, used to determine the fittest individual at each iteration.

Selection: Select best individual based on fitness score.

Crossover: Two individual are combined to produce an offspring, allowing for exchange of genetic information.

crossover-offspring-ga

Mutation: Small random changes are sometimes introduced to individuals during crossover to explore new solutions.

Algorithms stop either when number of max generation as been reached or if convergence has been reached (convergence is when after multiple crossover/mutation individual are identical).

Source:

https://en.wikipedia.org/wiki/Genetic_algorithm


https://www.section.io/engineering-education/the-basics-of-genetic-algorithms-in-ml/


https://towardsdatascience.com/introduction-to-genetic-algorithms-including-example-code-e396e98d8bf3