thefittest

repository·main·Indexed 40 days ago

https://github.com/sherstpasha/thefittest

An open-source library for applying classical evolutionary algorithms to optimization and machine learning tasks. Version 0.2.8 provides high-performance implementations of genetic algorithms, differential evolution (including SHADE and jDE), and genetic programming. It includes evolutionary classifiers and regressors such as MLPEAClassifier and GPClassifier, as well as benchmarks for continuous optimization, symbolic regression, and ML datasets.

Tokens
24.5K
Snippets
78
Records
108
Agent score
95%

What's inside thefittest

  1. Thefittest Module Overview

    main

    The library is organized into several functional modules:

    • Optimizers: Contains evolutionary algorithms such as DifferentialEvolution, jDE, SHADE, GeneticAlgorithm, SelfCGA, PDPGA, GeneticProgramming, SelfCGP, PDPGP, and SHAGA.
    • Classifiers: Evolutionary machine learning classifiers including GPClassifier (Genetic Programming), MLPEAClassifier, and GPNNClassifier (Genetic Programming Neural Network).
    • Regressors: Evolutionary machine learning regressors including GPRegressor, MLPEARegressor, and GPNNRegressor.
    • Benchmarks: Provides ML Datasets, Optimization Functions, and Benchmark Suites.
    • Utils: Low-level evolutionary operators including selections, crossovers, mutations, transformations, and random utilities.
  2. Use Neural Network Classifiers with Evolutionary Optimization

    main

    The library provides neural network classifiers that replace traditional gradient descent with evolutionary algorithms for training or architecture evolution. This allows for optimizing network weights or evolving the network structure itself using evolutionary strategies.

    Available implementations:

    • thefittest.classifiers.MLPEAClassifier: A Multi-Layer Perceptron (MLP) that uses an evolutionary algorithm-based approach for weight optimization.
    • thefittest.classifiers.GeneticProgrammingNeuralNetClassifier: A hybrid approach that uses Genetic Programming to evolve the neural network architecture and Evolutionary Algorithms (EA) to optimize the weights.
  3. Genetic Algorithms

    main

    Genetic Algorithms (GA) are search heuristics inspired by natural selection. They typically use binary string representations and evolve solutions through selection, crossover, and mutation operators over multiple generations.

    Available implementations in thefittest.optimizers:

    • GeneticAlgorithm: The classical GA using binary string representation.
    • SelfCGA: A self-configuring GA that performs automatic parameter tuning.
    • PDPGA: Population-level Dynamic Probabilities Genetic Algorithm with operator probability adaptation.
    • SHAGA: Success-History based Adaptive Genetic Algorithm.
  4. What rebuild-docs.bat does

    main

    The rebuild-docs.bat script automates the documentation build process through the following steps:

    1. Cleans the previous build using make.bat clean.
    2. Generates new HTML documentation using make.bat html.
    3. Copies the generated HTML from build/html/ to the docs/ root.
    4. Removes the temporary build/ directory.
  5. Differential Evolution Optimizers

    main

    Differential Evolution (DE) is a population-based stochastic optimization method designed for continuous optimization problems. It operates on real-valued vectors and uses vector differences to generate new candidate solutions.

    Available implementations in thefittest.optimizers:

    • DifferentialEvolution: The classical DE algorithm supporting multiple mutation strategies.
    • jDE: A self-adaptive DE variant with dynamic parameter control.
    • SHADE: Success-History based Adaptive Differential Evolution featuring parameter adaptation.
  6. Genetic Programming

    main

    Genetic Programming (GP) evolves computer programs to solve problems, often using tree-based representations. It is suitable for tasks like symbolic regression and program synthesis.

    Available implementations in thefittest.optimizers:

    • GeneticProgramming: Standard GP for symbolic regression and program synthesis.
    • SelfCGP: Self-configuring Genetic Programming.
    • PDPGP: Population-level Dynamic Probabilities Genetic Programming.
  7. Use Genetic Programming Classifiers

    main

    Genetic Programming (GP) classifiers evolve symbolic expressions or tree structures to perform classification. They are useful for discovering interpretable decision rules and handling non-linear separations in data.

    Available implementation:

    • thefittest.classifiers.GeneticProgrammingClassifier: A GP-based classifier that evolves symbolic expressions to define decision boundaries.
  8. Use Neural Network Regressors with evolutionary optimization

    main

    The library provides neural network regressors that replace traditional gradient descent with evolutionary algorithms. This allows for optimizing neural network weights or evolving network architectures for continuous value prediction.

    Available implementations:

    • MLPEARegressor: A Multi-Layer Perceptron that uses an evolutionary algorithm for weight optimization.
    • GeneticProgrammingNeuralNetRegressor: A neural network that combines GP-evolved architectures with EA-optimized weights.
  9. Rebuild the documentation locally

    main

    To rebuild the project documentation, navigate to the docs directory and execute the rebuild-docs.bat script. After rebuilding, you should commit and push the changes to update the hosted documentation.

    Workflow:

    1. Navigate to the docs folder.
    2. Run rebuild-docs.bat.
    3. Return to the root directory.
    4. Commit and push the updated documentation files.
    cd c:\Users\pasha\thefittest\docs
    .\rebuild-docs.bat
    cd ..
    git add .
    git commit -m "docs: update documentation"
    git push