{"id":18774618,"url":"https://github.com/lahovniktadej/gatree","last_synced_at":"2025-07-05T20:03:37.551Z","repository":{"id":197192251,"uuid":"696273966","full_name":"lahovniktadej/gatree","owner":"lahovniktadej","description":"Evolutionary decision trees","archived":false,"fork":false,"pushed_at":"2024-11-11T10:27:48.000Z","size":1071,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T11:35:23.399Z","etag":null,"topics":["decision-tree","evolutionary-algorithm","genetic-algorithm","machine-learning"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/gatree","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lahovniktadej.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-25T12:40:18.000Z","updated_at":"2024-12-19T17:34:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"203be422-9481-4cbe-bd00-ed3a2cc1675b","html_url":"https://github.com/lahovniktadej/gatree","commit_stats":null,"previous_names":["lahovniktadej/gatree"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lahovniktadej%2Fgatree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lahovniktadej%2Fgatree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lahovniktadej%2Fgatree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lahovniktadej%2Fgatree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lahovniktadej","download_url":"https://codeload.github.com/lahovniktadej/gatree/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248402545,"owners_count":21097331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decision-tree","evolutionary-algorithm","genetic-algorithm","machine-learning"],"created_at":"2024-11-07T19:38:48.451Z","updated_at":"2025-04-13T09:21:54.501Z","avatar_url":"https://github.com/lahovniktadej.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"GATree\" src=\".github/images/gatree.png\" width=\"175\" /\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e\n    GATree\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"PyPI version\" src=\"https://img.shields.io/pypi/v/gatree.svg\" /\u003e\n    \u003cimg alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/gatree.svg\"\u003e\n    \u003ca href=\"https://pepy.tech/project/gatree\"\u003e\n        \u003cimg alt=\"PyPI - Downloads\" src=\"https://img.shields.io/pypi/dm/gatree.svg\"\u003e\n    \u003c/a\u003e\n    \u003cimg alt=\"Downloads\" src=\"https://static.pepy.tech/badge/gatree\"\u003e\n    \u003cimg alt=\"GATree\" src=\"https://github.com/lahovniktadej/gatree/actions/workflows/test.yml/badge.svg\" /\u003e\n    \u003cimg alt=\"Documentation status\" src=\"https://readthedocs.org/projects/gatree/badge/?version=latest\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"Repository size\" src=\"https://img.shields.io/github/repo-size/lahovniktadej/gatree\" /\u003e\n    \u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/lahovniktadej/gatree.svg\" /\u003e\n    \u003cimg alt=\"GitHub commit activity\" src=\"https://img.shields.io/github/commit-activity/w/lahovniktadej/gatree.svg\"\u003e\n    \u003ca href=\"http://isitmaintained.com/project/lahovniktadej/gatree\"\u003e\n        \u003cimg alt=\"Percentage of issues still open\" src=\"http://isitmaintained.com/badge/open/lahovniktadej/gatree.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://isitmaintained.com/project/lahovniktadej/gatree\"\u003e\n        \u003cimg alt=\"Average time to resolve an issue\" src=\"http://isitmaintained.com/badge/resolution/lahovniktadej/gatree.svg\"\u003e\n    \u003c/a\u003e\n    \u003cimg alt=\"GitHub contributors\" src=\"https://img.shields.io/github/contributors/lahovniktadej/gatree.svg\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://zenodo.org/doi/10.5281/zenodo.13307403\"\u003e\n        \u003cimg alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.13307404.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://doi.org/10.21105/joss.06748\"\u003e\n        \u003cimg alt=\"JOSS\" src=\"https://joss.theoj.org/papers/10.21105/joss.06748/status.svg\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"#-about\"\u003e📋 About \u003c/a\u003e  •\n    \u003ca href=\"#-installation\"\u003e📦 Installation\u003c/a\u003e •\n    \u003ca href=\"#-usage\"\u003e🚀 Usage\u003c/a\u003e •\n    \u003ca href=\"#-genetic-operators-in-gatree\"\u003e🧬 Genetic Operators\u003c/a\u003e •\n    \u003ca href=\"#-community-guidelines\"\u003e🫂 Community Guidelines\u003c/a\u003e •\n    \u003ca href=\"#-license\"\u003e📜 License\u003c/a\u003e\n\u003c/p\u003e\n\n## 📋 About\nGATree is a Python library designed for implementing evolutionary decision trees using a standard genetic algorithm approach. The library provides functionalities for selection, mutation, and crossover operations within the decision tree structure, allowing users to evolve and optimise decision trees for various classification and clustering tasks. 🌲🧬\n\nThe library's core objective is to empower users in creating and fine-tuning decision trees through an evolutionary process, opening avenues for innovative approaches to classification and clustering problems. GATree enables the dynamic growth and adaptation of decision trees, offering a flexible and powerful tool for machine learning enthusiasts and practitioners. 🚀🌿\n\nGATree is currently limited to classification and clustering tasks, with support for regression tasks planned for future releases. 💡\n\n* **Free software:** MIT license\n* **Documentation**: [http://gatree.readthedocs.io](http://gatree.readthedocs.io)\n* **Python**: 3.9, 3.10, 3.11, 3.12\n* **Dependencies**: listed in [CONTRIBUTING.md](./CONTRIBUTING.md#dependencies)\n* **Operating systems**: Windows, Ubuntu, macOS\n\n## 📦 Installation\n### pip\nTo install `GATree` using pip, run the following command:\n```bash\npip install gatree\n```\n\n## 🚀 Usage\nThe following example demonstrates how to perform classification of the iris dataset using `GATree`. More examples can be found in the [examples](./examples) directory.\n\n```python\nimport pandas as pd\nfrom sklearn.datasets import load_iris\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import accuracy_score\nfrom gatree.methods.gatreeclassifier import GATreeClassifier\n\n# Load the iris dataset\niris = load_iris()\nX = pd.DataFrame(iris.data, columns=iris.feature_names)\ny = pd.Series(iris.target, name='target')\n\n# Split the dataset into training and testing sets\nX_train, X_test, y_train, y_test = train_test_split(\n    X, y, test_size=0.2, random_state=¸10)\n\n# Create and fit the GATree classifier\ngatree = GATreeClassifier(n_jobs=16, random_state=32)\ngatree.fit(X=X_train, y=y_train, population_size=100, max_iter=100)\n\n# Make predictions on the testing set\ny_pred = gatree.predict(X_test)\n\n# Evaluate the accuracy of the classifier\nprint(accuracy_score(y_test, y_pred))\n```\n\n## 🧬 Genetic Operators in `GATree`\nThe genetic algorithm for decision trees in `GATree` involves several key operators: _selection_, _elitism_, _crossover_, and _mutation_. Each of these operators plays a crucial role in the evolution and optimisation of the decision trees. Below is a detailed description of each operator within the context of the `GATree` class.\n\n### Selection\nSelection is the process of choosing parent trees from the current population to produce offspring for the next generation. By default, `GATree` class uses tournament selection, a method where a subset of the population is randomly chosen, and the best individual from this subset is selected.\n\n### Elitism\nElitism ensures that the best-performing individuals (trees) from the current generation are carried over to the next generation without any modification. This guarantees that the quality of the population does not decrease from one generation to the next.\n\n### Crossover\n\nCrossover is a genetic operator used to combine the genetic information of two parent trees to generate new offspring. This enables exploration, which helps in creating diversity in the population and combining good traits from both parents.\n\n### Mutation\nMutation introduces random changes to a tree to maintain genetic diversity and explore new solutions. This helps in avoiding local optima by introducing new genetic structures.\n\n## 🫂 Community Guidelines\n### Contributing\nTo contribure to the software, please read the [contributing guidelines](./CONTRIBUTING.md).\n\n### Reporting Issues\nIf you encounter any issues with the library, please report them using the [issue tracker](https://github.com/lahovniktadej/gatree/issues). Include a detailed description of the problem, including the steps to reproduce the problem, the stack trace, and details about your operating system and software version.\n\n### Seeking Support\nIf you need support, please first refer to the [documentation](http://gatree.readthedocs.io). If you still require assistance, please open an issue on the [issue tracker](https://github.com/lahovniktadej/gatree/issues) with the `question` tag. For private inquiries, you can contact us via e-mail at [tadej.lahovnik1@um.si](mailto:tadej.lahovnik1@um.si) or [saso.karakatic@um.si](mailto:saso.karakatic@um.si).\n\n## 📜 License\nThis package is distributed under the MIT License. This license can be found online at \u003chttp://www.opensource.org/licenses/MIT\u003e.\n\n## Disclaimer\nThis framework is provided as-is, and there are no guarantees that it fits your purposes or that it is bug-free. Use it at your own risk!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flahovniktadej%2Fgatree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flahovniktadej%2Fgatree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flahovniktadej%2Fgatree/lists"}