Package: eckity
EC-KitYis a Python tool kit for doing evolutionary computation, and it is scikit-learn compatible.Currently we have implemented Genetic Algorithm (GA) and tree-based Genetic Programming (GP), but EC-KitY will grow!EC-KitYis:A comprehensive toolkit for running evolutionary algorithmsWritten in PythonCan work with or without scikit-learn, i.e., supports both sklearn and non-sklearn modesDesigned with modern software engineering in mindDesigned to support all popular EC paradigms (GA, GP, ES, coevolution, multi-objective, etc').DependenciesFor 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 installationpip install eckityDocumentationAPI is availablehere(Work in progress - some modules and functions are not documented yet.)TutorialsThe tutorials are availablehere, walking you through running EC-KitY both in sklearn mode and in non-sklearn mode.ExamplesMore examples are in theexamplesfolder.
All you need to do is define a fitness-evaluation method, through aSimpleIndividualEvaluatorsub-class.
You can run the examples with ease by opening thiscolab notebook.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 theSymbolic Regression Tutorial.fromeckity.algorithms.simple_evolutionimportSimpleEvolutionfromeckity.subpopulationimportSubpopulationfromexamples.treegp.non_sklearn_mode.symbolic_regression.sym_reg_evaluatorimportSymbolicRegressionEvaluatoralgo=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 sklearnThe 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 theSklearn Symbolic Regression Tutorial.A simple sklearn-compatible EA run:fromsklearn.datasetsimportmake_regressionfromsklearn.metricsimportmean_absolute_errorfromsklearn.model_selectionimporttrain_test_splitfromeckity.algorithms.simple_evolutionimportSimpleEvolutionfromeckity.creators.gp_creators.fullimportFullCreatorfromeckity.genetic_encodings.gp.tree.utilsimportcreate_terminal_setfromeckity.sklearn_compatible.regression_evaluatorimportRegressionEvaluatorfromeckity.sklearn_compatible.sk_regressorimportSKRegressorfromeckity.subpopulationimportSubpopulationX,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 comparisonHere's a comparison table. The full paper is availablehere.AuthorsMoshe Sipper,Achiya Elyasaf,Itai Tzruia,
Tomer HalperinCitationCitations are always appreciated 😊:@article{eckity2023,
author = {Moshe Sipper and Tomer Halperin and Itai Tzruia and Achiya Elyasaf},
title = {{EC-KitY}: Evolutionary computation tool kit in {Python} with seamless machine learning integration},
journal = {SoftwareX},
volume = {22},
pages = {101381},
year = {2023},
url = {https://www.sciencedirect.com/science/article/pii/S2352711023000778},
}

@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/} }
}Sample repos using EC-KitYEC-KitY-Maze-ExampleEvolutionTSPSolving The 'Nurse Scheduling Problem' With EC-KitY