GeneticEngine


NameGeneticEngine JSON
Version 0.9.0 PyPI version JSON
download
home_pageNone
SummaryGenetic Programming with Types and Grammars
upload_time2024-12-09 13:53:51
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licensehttps://opensource.org/licenses/MIT
keywords evolutionary computation genetic programming regression machine learning
VCS
bugtrack_url
requirements dill lark loguru numpy palettable pandas pathos polyleven pytest pytest-benchmark scikit-learn seaborn sympy threadpoolctl z3-solver
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Genetic Engine
==============

[![Documentation](https://readthedocs.org/projects/geneticengine/badge/?version=latest)](https://geneticengine.readthedocs.io/en/latest/)
[![codecov](https://codecov.io/gh/alcides/GeneticEngine/branch/main/graph/badge.svg?token=ZX84SA7IEP)](https://codecov.io/gh/alcides/GeneticEngine)

A hybrid between strongly-typed (STGP) and grammar-guided genetic programming (GGGP).

About GeneticEngine
-------------------

GeneticEngine is a Genetic Programming framework for single- and multi-objective optimization. GeneticEngine allows the user to provide domain knowledge about the shape of the solution (using type annotations) and by defining the fitness function.


Documentation
-------------

* [Documentation](https://geneticengine.readthedocs.io/)
* [Examples](examples/)

```python
class MyExpr(ABC):
	"MyExpr is a non-terminal/abstract class."
	def eval(self):
		...

@dataclass
class Plus(MyExpr):
	"E -> E + E"
	left: MyExpr
	right: MyExpr

	def eval(self):
		return self.left.eval() + self.right.eval()

@dataclass
class Literal(MyExpr):
	"E -> <int>"
	value: int

	def eval(self):
		return self.value
```

In this small example, we are defining the language that supports the plus operator and integer literals. GeneticEngine will be able to automatically generate all possible expressions, such as `Plus(left=Plus(left=Literal(12), right=Literal(12)), right=Literal(15))`, and guide the search towards your goal (e.g., `lambda x: abs(x-2022)`). For this very simple toy problem, it will find an expression that computes 2022, ideally as small as possible. And this is a very uninteresting example. But if you introduce variables into the mix, you have a very powerful symbolic regression toolkit for arbitrarily complex expressions.


Contributing
-------------

After cloning the repo, please run `source setup_dev.sh` to install virtualenv, all dependencies and setup all pre-commit hooks.

Pull Requests are more than welcome!


Authors
----------
GeneticEngine has been developed at [LASIGE](https://www.lasige.pt), [University of Lisbon](https://ciencias.ulisboa.pt) by:

* [Alcides Fonseca](http://alcidesfonseca.com)
* [Leon Ingelse](https://leoningel.github.io)
* [Guilherme Espada](https://www.lasige.di.fc.ul.pt/user/732)
* [Paulo Santos](https://pcanelas.com/)
* [Pedro Barbosa](https://www.lasige.di.fc.ul.pt/user/661)
* [Eduardo Madeira](https://www.lasige.pt/member/jose-eduardo-madeira)

Acknowledgements
----------------

This work was supported by Fundação para a Ciência e Tecnologia (FCT) through:

* [the LASIGE Research Unit](https://www.lasige.pt) (ref. UIDB/00408/2020 and UIDP/00408/2020)
* Pedro Barbosa PhD fellowship (SFRH/BD/137062/2018)
* Guilherme Espada PhD fellowship (UI/BD/151179/2021)
* Paulo Santos CMU|Portugal PhD fellowship (SFRH/BD/151469/2021)
* [the FCT Exploratory project RAP](http://wiki.alcidesfonseca.com/research/projects/rap/) (EXPL/CCI-COM/1306/2021)
* the FCT Advanced Computing projects (2022.15800.CPCA.A1, CPCA/A1/395424/2021, CPCA/A1/5613/2020, CPCA/A2/6009/2020)

And by Lisboa2020, Compete2020 and FEDER through:

* [the CMU|Portugal CAMELOT project](http://wiki.alcidesfonseca.com/research/projects/camelot/) (LISBOA-01-0247-FEDER-045915)


Publications
-----------------

* [Comparing the expressive power of Strongly-Typed and Grammar-Guided Genetic Programming](https://www.researchgate.net/publication/370277603_Comparing_the_expressive_power_of_Strongly-Typed_and_Grammar-Guided_Genetic_Programming) at GECCO'23
* [Data types as a more ergonomic frontend for Grammar-Guided Genetic Programming](https://arxiv.org/pdf/2210.04826) at GPCE'22
* [Grammatical Evolution Mapping for Semantically-Constrained Genetic Programming](https://www.researchgate.net/profile/Alcides-Fonseca/publication/358528379_Grammatical_Evolution_Mapping_for_Semantically-Constrained_Genetic_Programming/links/620a1ecf634ff774f4cc2cee/Grammatical-Evolution-Mapping-for-Semantically-Constrained-Genetic-Programming.pdf) at GPTP'21
* [The Usability Argument for Refinement Typed Genetic Programming](https://link.springer.com/chapter/10.1007/978-3-030-58115-2_2) at PPSN'20

Applications of GeneticEngine
-----------------------------
* [Semantically Rich Local Dataset Generation for Explainable AI in Genomics](https://www.researchgate.net/publication/381960322_Semantically_Rich_Local_Dataset_Generation_for_Explainable_AI_in_Genomics) at GECCO'24
* [Comparing Individual Representations in Grammar-Guided Genetic Programming for Glucose Prediction in People with Diabetes](https://www.researchgate.net/publication/371324298_Comparing_Individual_Representations_in_Gram-mar-Guided_Genetic_Programming_for_Glucose_Prediction_in_People_with_Diabetes) at Grammatical Workshop at GECCO'23
* [Domain-Aware Feature Learning with Grammar-Guided Genetic Programming](https://link.springer.com/chapter/10.1007/978-3-031-29573-7_15) at EuroGP'23
* [Benchmarking Individual Representation in Grammar-Guided Genetic Programming](https://wwwww.easychair.org/publications/preprint_download/wqrb) at Evo*'22


Let us know if your paper uses Genetic Engine, to list it here.

Please cite as:

```
Espada, Guilherme, et al. "Data types as a more ergonomic frontend for Grammar-Guided Genetic Programming.", GPCE '22: Concepts and Experiences, 2022
```

Bibtex:

```
@inproceedings{espada2022data,
  author={Guilherme Espada and Leon Ingelse and Paulo Canelas and Pedro Barbosa and Alcides Fonseca},
  editor    = {Bernhard Scholz and Yukiyoshi Kameyama},
  title={Datatypes as a More Ergonomic Frontend for Grammar-Guided Genetic Programming},
  booktitle = {{GPCE} '22: Concepts and Experiences, Auckland, NZ, December 6 - 7, 2022},
  pages     = {1},
  publisher = {{ACM}},
  year      = {2022},
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "GeneticEngine",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "evolutionary computation, genetic programming, regression, machine learning",
    "author": null,
    "author_email": "Guilherme Espada <gjespada@fc.ul.pt>, Leon Ingelse <leoningelse@gmail.com>, Paulo Santos <pacsantos@fc.ul.pt>, Pedro Barbosa <psbarbosa@ciencias.ulisboa.pt>, Alcides Fonseca <me@alcidesfonseca.com>",
    "download_url": "https://files.pythonhosted.org/packages/6e/12/23dc84a697bc08a754b406daf0ab12f8e1fc198e979c3aec9062a55b5f8b/geneticengine-0.9.0.tar.gz",
    "platform": null,
    "description": "Genetic Engine\n==============\n\n[![Documentation](https://readthedocs.org/projects/geneticengine/badge/?version=latest)](https://geneticengine.readthedocs.io/en/latest/)\n[![codecov](https://codecov.io/gh/alcides/GeneticEngine/branch/main/graph/badge.svg?token=ZX84SA7IEP)](https://codecov.io/gh/alcides/GeneticEngine)\n\nA hybrid between strongly-typed (STGP) and grammar-guided genetic programming (GGGP).\n\nAbout GeneticEngine\n-------------------\n\nGeneticEngine is a Genetic Programming framework for single- and multi-objective optimization. GeneticEngine allows the user to provide domain knowledge about the shape of the solution (using type annotations) and by defining the fitness function.\n\n\nDocumentation\n-------------\n\n* [Documentation](https://geneticengine.readthedocs.io/)\n* [Examples](examples/)\n\n```python\nclass MyExpr(ABC):\n\t\"MyExpr is a non-terminal/abstract class.\"\n\tdef eval(self):\n\t\t...\n\n@dataclass\nclass Plus(MyExpr):\n\t\"E -> E + E\"\n\tleft: MyExpr\n\tright: MyExpr\n\n\tdef eval(self):\n\t\treturn self.left.eval() + self.right.eval()\n\n@dataclass\nclass Literal(MyExpr):\n\t\"E -> <int>\"\n\tvalue: int\n\n\tdef eval(self):\n\t\treturn self.value\n```\n\nIn this small example, we are defining the language that supports the plus operator and integer literals. GeneticEngine will be able to automatically generate all possible expressions, such as `Plus(left=Plus(left=Literal(12), right=Literal(12)), right=Literal(15))`, and guide the search towards your goal (e.g., `lambda x: abs(x-2022)`). For this very simple toy problem, it will find an expression that computes 2022, ideally as small as possible. And this is a very uninteresting example. But if you introduce variables into the mix, you have a very powerful symbolic regression toolkit for arbitrarily complex expressions.\n\n\nContributing\n-------------\n\nAfter cloning the repo, please run `source setup_dev.sh` to install virtualenv, all dependencies and setup all pre-commit hooks.\n\nPull Requests are more than welcome!\n\n\nAuthors\n----------\nGeneticEngine has been developed at [LASIGE](https://www.lasige.pt), [University of Lisbon](https://ciencias.ulisboa.pt) by:\n\n* [Alcides Fonseca](http://alcidesfonseca.com)\n* [Leon Ingelse](https://leoningel.github.io)\n* [Guilherme Espada](https://www.lasige.di.fc.ul.pt/user/732)\n* [Paulo Santos](https://pcanelas.com/)\n* [Pedro Barbosa](https://www.lasige.di.fc.ul.pt/user/661)\n* [Eduardo Madeira](https://www.lasige.pt/member/jose-eduardo-madeira)\n\nAcknowledgements\n----------------\n\nThis work was supported by Funda\u00e7\u00e3o para a Ci\u00eancia e Tecnologia (FCT) through:\n\n* [the LASIGE Research Unit](https://www.lasige.pt) (ref. UIDB/00408/2020 and UIDP/00408/2020)\n* Pedro Barbosa PhD fellowship (SFRH/BD/137062/2018)\n* Guilherme Espada PhD fellowship (UI/BD/151179/2021)\n* Paulo Santos CMU|Portugal PhD fellowship (SFRH/BD/151469/2021)\n* [the FCT Exploratory project RAP](http://wiki.alcidesfonseca.com/research/projects/rap/) (EXPL/CCI-COM/1306/2021)\n* the FCT Advanced Computing projects (2022.15800.CPCA.A1, CPCA/A1/395424/2021, CPCA/A1/5613/2020, CPCA/A2/6009/2020)\n\nAnd by Lisboa2020, Compete2020 and FEDER through:\n\n* [the CMU|Portugal CAMELOT project](http://wiki.alcidesfonseca.com/research/projects/camelot/) (LISBOA-01-0247-FEDER-045915)\n\n\nPublications\n-----------------\n\n* [Comparing the expressive power of Strongly-Typed and Grammar-Guided Genetic Programming](https://www.researchgate.net/publication/370277603_Comparing_the_expressive_power_of_Strongly-Typed_and_Grammar-Guided_Genetic_Programming) at GECCO'23\n* [Data types as a more ergonomic frontend for Grammar-Guided Genetic Programming](https://arxiv.org/pdf/2210.04826) at GPCE'22\n* [Grammatical Evolution Mapping for Semantically-Constrained Genetic Programming](https://www.researchgate.net/profile/Alcides-Fonseca/publication/358528379_Grammatical_Evolution_Mapping_for_Semantically-Constrained_Genetic_Programming/links/620a1ecf634ff774f4cc2cee/Grammatical-Evolution-Mapping-for-Semantically-Constrained-Genetic-Programming.pdf) at GPTP'21\n* [The Usability Argument for Refinement Typed Genetic Programming](https://link.springer.com/chapter/10.1007/978-3-030-58115-2_2) at PPSN'20\n\nApplications of GeneticEngine\n-----------------------------\n* [Semantically Rich Local Dataset Generation for Explainable AI in Genomics](https://www.researchgate.net/publication/381960322_Semantically_Rich_Local_Dataset_Generation_for_Explainable_AI_in_Genomics) at GECCO'24\n* [Comparing Individual Representations in Grammar-Guided Genetic Programming for Glucose Prediction in People with Diabetes](https://www.researchgate.net/publication/371324298_Comparing_Individual_Representations_in_Gram-mar-Guided_Genetic_Programming_for_Glucose_Prediction_in_People_with_Diabetes) at Grammatical Workshop at GECCO'23\n* [Domain-Aware Feature Learning with Grammar-Guided Genetic Programming](https://link.springer.com/chapter/10.1007/978-3-031-29573-7_15) at EuroGP'23\n* [Benchmarking Individual Representation in Grammar-Guided Genetic Programming](https://wwwww.easychair.org/publications/preprint_download/wqrb) at Evo*'22\n\n\nLet us know if your paper uses Genetic Engine, to list it here.\n\nPlease cite as:\n\n```\nEspada, Guilherme, et al. \"Data types as a more ergonomic frontend for Grammar-Guided Genetic Programming.\", GPCE '22: Concepts and Experiences, 2022\n```\n\nBibtex:\n\n```\n@inproceedings{espada2022data,\n  author={Guilherme Espada and Leon Ingelse and Paulo Canelas and Pedro Barbosa and Alcides Fonseca},\n  editor    = {Bernhard Scholz and Yukiyoshi Kameyama},\n  title={Datatypes as a More Ergonomic Frontend for Grammar-Guided Genetic Programming},\n  booktitle = {{GPCE} '22: Concepts and Experiences, Auckland, NZ, December 6 - 7, 2022},\n  pages     = {1},\n  publisher = {{ACM}},\n  year      = {2022},\n}\n```\n",
    "bugtrack_url": null,
    "license": "https://opensource.org/licenses/MIT",
    "summary": "Genetic Programming with Types and Grammars",
    "version": "0.9.0",
    "project_urls": {
        "documentation": "https://github.com/alcides/GeneticEngine/",
        "homepage": "https://github.com/alcides/GeneticEngine/",
        "repository": "https://github.com/alcides/GeneticEngine/"
    },
    "split_keywords": [
        "evolutionary computation",
        " genetic programming",
        " regression",
        " machine learning"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5347e68a91e69f588196f8b891334eebe5e7eab9b985b839c1f3965acaaf8ce2",
                "md5": "1c490cd617c736856a72e2defd564d0c",
                "sha256": "681cb80d9be654ac5745cd3303a253c1dc54288ec9ba44314fb1fe881fad8abd"
            },
            "downloads": -1,
            "filename": "GeneticEngine-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1c490cd617c736856a72e2defd564d0c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 192732,
            "upload_time": "2024-12-09T13:53:49",
            "upload_time_iso_8601": "2024-12-09T13:53:49.874264Z",
            "url": "https://files.pythonhosted.org/packages/53/47/e68a91e69f588196f8b891334eebe5e7eab9b985b839c1f3965acaaf8ce2/GeneticEngine-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6e1223dc84a697bc08a754b406daf0ab12f8e1fc198e979c3aec9062a55b5f8b",
                "md5": "1bb5f16e0a026b832df35181f68ff2d7",
                "sha256": "c0e53cb58bea1bf8435d4973b4c47b9831b384b62d3761aaff7e29e0d50ae423"
            },
            "downloads": -1,
            "filename": "geneticengine-0.9.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1bb5f16e0a026b832df35181f68ff2d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 120952,
            "upload_time": "2024-12-09T13:53:51",
            "upload_time_iso_8601": "2024-12-09T13:53:51.647179Z",
            "url": "https://files.pythonhosted.org/packages/6e/12/23dc84a697bc08a754b406daf0ab12f8e1fc198e979c3aec9062a55b5f8b/geneticengine-0.9.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-09 13:53:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alcides",
    "github_project": "GeneticEngine",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "dill",
            "specs": [
                [
                    "==",
                    "0.3.9"
                ]
            ]
        },
        {
            "name": "lark",
            "specs": [
                [
                    "==",
                    "1.2.2"
                ]
            ]
        },
        {
            "name": "loguru",
            "specs": [
                [
                    "==",
                    "0.7.2"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "2.1.3"
                ]
            ]
        },
        {
            "name": "palettable",
            "specs": [
                [
                    "==",
                    "3.3.3"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "2.2.3"
                ]
            ]
        },
        {
            "name": "pathos",
            "specs": [
                [
                    "==",
                    "0.3.3"
                ]
            ]
        },
        {
            "name": "polyleven",
            "specs": [
                [
                    "==",
                    "0.8"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "8.3.4"
                ]
            ]
        },
        {
            "name": "pytest-benchmark",
            "specs": [
                [
                    "==",
                    "5.1.0"
                ]
            ]
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    "==",
                    "1.5.2"
                ]
            ]
        },
        {
            "name": "seaborn",
            "specs": [
                [
                    "==",
                    "0.13.2"
                ]
            ]
        },
        {
            "name": "sympy",
            "specs": [
                [
                    "==",
                    "1.13.3"
                ]
            ]
        },
        {
            "name": "threadpoolctl",
            "specs": [
                [
                    "==",
                    "3.5.0"
                ]
            ]
        },
        {
            "name": "z3-solver",
            "specs": [
                [
                    "==",
                    "4.13.3.0"
                ]
            ]
        }
    ],
    "lcname": "geneticengine"
}
        
Elapsed time: 0.36919s