Skip to main content

EC-KitY: Evolutionary Computation Tool Kit in Python.

Project description

image

EC-KitY is a Python tool kit for doing evolutionary computation. It is scikit-learn-compatible and is distributed under the GNU General Public License v3.0. Currently we have implemented tree-based genetic programming (GP), but EC-KitY will grow!

EC-KitY is:

  • A comprehensive toolkit for running evolutionary algorithms
  • Written in Python
  • Can work with or without scikit-learn, i.e., supports both sklearn and non-sklearn modes
  • Designed with modern software engineering in mind
  • Designed to support all popular EC paradigms (GA, GP, ES, coevolution, multi-objective, etc').

Dependencies

For the basic evolution mode, EC-KitY requires:

  • numpy (>=1.14.6)
  • pandas (>=0.25.0)
  • overrides (>= 6.1.0)

For sklearn mode, EC-KitY additionally requires:

  • scikit-learn (>=0.24.2)

User installation

git clone https://github.com/EC-KitY/EC-KitY.git

For basic package installation: pip install -r requirements.txt

Documentation

After cloning the project, navigate to the doc\api folder and open eckity.html file. This will open an html page from which you can access the documentation of all the modules.

(Work in progress - some modules and functions are not documented yet.)

Tutorials

There are 4 tutorials available here, walking you through running EC-KitY both in sklearn mode and in non-sklearn mode.

Examples

More examples are in the examples folder. All you need to do is define a fitness-evaluation method, through a SimpleIndividualEvaluator sub-class.

Basic example (no sklearn)

You can run an EA with just 3 lines of code. The problem being solved herein is simple symbolic regression.

Additional information on this problem can be found in the Symbolic Regression Tutorial.

from eckity.algorithms.simple_evolution import SimpleEvolution
from eckity.subpopulation import Subpopulation
from examples.treegp.non_sklearn_mode.symbolic_regression.sym_reg_evaluator import SymbolicRegressionEvaluator

algo = SimpleEvolution(Subpopulation(SymbolicRegressionEvaluator()))
algo.evolve()
print(f'algo.execute(x=2,y=3,z=4): {algo.execute(x=2, y=3, z=4)}')

Example with sklearn

The problem being solved herein is the same problem, but in this case we also involve sklearn compatability - a core feature of EC-KitY. Additional information for this example can be found in the Sklearn Symbolic Regression Tutorial.

A simple sklearn-compatible EA run:

from sklearn.datasets import make_regression
from sklearn.metrics import mean_absolute_error
from sklearn.model_selection import train_test_split

from eckity.algorithms.simple_evolution import SimpleEvolution
from eckity.creators.gp_creators.full import FullCreator
from eckity.genetic_encodings.gp.tree.utils import create_terminal_set
from eckity.sklearn_compatible.regression_evaluator import RegressionEvaluator
from eckity.sklearn_compatible.sk_regressor import SKRegressor
from eckity.subpopulation import Subpopulation

X, y = make_regression(n_samples=100, n_features=3)
terminal_set = create_terminal_set(X)

algo = SimpleEvolution(Subpopulation(creators=FullCreator(terminal_set=terminal_set),
                                     evaluator=RegressionEvaluator()))
regressor = SKRegressor(algo)

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
regressor.fit(X_train, y_train)
print('MAE on test set:', mean_absolute_error(y_test, regressor.predict(X_test)))

Feature comparison

We are working on a paper that describes EC-KitY. For now, here is a table comparing EC-KitY with 8 other libraries: image

Authors

Moshe Sipper, Achiya Elyasaf, Itai Tzruia, Tomer Halperin

Citation

Citations are always appreciated 😊:

@article{eckity2022,
    author = {Sipper, Moshe and Halperin, Tomer and Tzruia, Itai and  Elyasaf, Achiya},
    title = {{EC-KitY}: Evolutionary Computation Tool Kit in {Python}},
    journal = {},
    volume = {},
    pages = {},
    year = {2022},
    note = {in preparation}
}

@misc{eckity2022git,
    author = {Sipper, Moshe and Halperin, Tomer and Tzruia, Itai and  Elyasaf, Achiya},
    title = {{EC-KitY}: Evolutionary Computation Tool Kit in {Python}},
    year = {2022},
    publisher = {GitHub},
    journal = {GitHub repository},
    howpublished = {\url{https://www.eckity.org/} }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eckity-0.1.1.tar.gz (47.2 kB view details)

Uploaded Source

Built Distribution

eckity-0.1.1-py3-none-any.whl (73.9 kB view details)

Uploaded Python 3

File details

Details for the file eckity-0.1.1.tar.gz.

File metadata

  • Download URL: eckity-0.1.1.tar.gz
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for eckity-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6bec811645250aaf2d6f1781a8378bd960b81f7750f45df827343496d0ca751c
MD5 61c6029bb2e8e6d6a99fdd7bdf752303
BLAKE2b-256 b2123ddc4c88a02b0e3d5ea57de3d504dbbf6b934fd005f398e2b4487c3a2d8b

See more details on using hashes here.

File details

Details for the file eckity-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: eckity-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 73.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for eckity-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 63ab7486129c6ae72cbf27d9d57912ecbccd3821c32004819ffd0afac48fdb06
MD5 d7fdb247b4d8128a768abca47fbf549e
BLAKE2b-256 06641d3d343f731c20a34a20436a69065b5a79f1016c8753785d8b6317d78177

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page