gatree


Namegatree JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-11-11 10:28:08
maintainerNone
docs_urlNone
authorTadej Lahovnik
requires_python<4.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <img alt="GATree" src=".github/images/gatree.png" width="175" />
</p>

<h1 align="center">
    GATree
</h1>

<p align="center">
    <img alt="PyPI version" src="https://img.shields.io/pypi/v/gatree.svg" />
    <img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/gatree.svg">
    <a href="https://pepy.tech/project/gatree">
        <img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/gatree.svg">
    </a>
    <img alt="Downloads" src="https://static.pepy.tech/badge/gatree">
    <img alt="GATree" src="https://github.com/lahovniktadej/gatree/actions/workflows/test.yml/badge.svg" />
    <img alt="Documentation status" src="https://readthedocs.org/projects/gatree/badge/?version=latest" />
</p>

<p align="center">
    <img alt="Repository size" src="https://img.shields.io/github/repo-size/lahovniktadej/gatree" />
    <img alt="License" src="https://img.shields.io/github/license/lahovniktadej/gatree.svg" />
    <img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/w/lahovniktadej/gatree.svg">
    <a href="http://isitmaintained.com/project/lahovniktadej/gatree">
        <img alt="Percentage of issues still open" src="http://isitmaintained.com/badge/open/lahovniktadej/gatree.svg">
    </a>
    <a href="http://isitmaintained.com/project/lahovniktadej/gatree">
        <img alt="Average time to resolve an issue" src="http://isitmaintained.com/badge/resolution/lahovniktadej/gatree.svg">
    </a>
    <img alt="GitHub contributors" src="https://img.shields.io/github/contributors/lahovniktadej/gatree.svg"/>
</p>

<p align="center">
    <a href="https://zenodo.org/doi/10.5281/zenodo.13307403">
        <img alt="DOI" src="https://zenodo.org/badge/DOI/10.5281/zenodo.13307404.svg">
    </a>
    <a href="https://doi.org/10.21105/joss.06748">
        <img alt="JOSS" src="https://joss.theoj.org/papers/10.21105/joss.06748/status.svg">
    </a>
</p>

<p align="center">
    <a href="#-about">πŸ“‹ About </a>  β€’
    <a href="#-installation">πŸ“¦ Installation</a> β€’
    <a href="#-usage">πŸš€ Usage</a> β€’
    <a href="#-genetic-operators-in-gatree">🧬 Genetic Operators</a> β€’
    <a href="#-community-guidelines">πŸ«‚ Community Guidelines</a> β€’
    <a href="#-license">πŸ“œ License</a>
</p>

## πŸ“‹ About
GATree 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. 🌲🧬

The 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. πŸš€πŸŒΏ

GATree is currently limited to classification and clustering tasks, with support for regression tasks planned for future releases. πŸ’‘

* **Free software:** MIT license
* **Documentation**: [http://gatree.readthedocs.io](http://gatree.readthedocs.io)
* **Python**: 3.9, 3.10, 3.11, 3.12
* **Dependencies**: listed in [CONTRIBUTING.md](./CONTRIBUTING.md#dependencies)
* **Operating systems**: Windows, Ubuntu, macOS

## πŸ“¦ Installation
### pip
To install `GATree` using pip, run the following command:
```bash
pip install gatree
```

## πŸš€ Usage
The following example demonstrates how to perform classification of the iris dataset using `GATree`. More examples can be found in the [examples](./examples) directory.

```python
import pandas as pd
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from gatree.methods.gatreeclassifier import GATreeClassifier

# Load the iris dataset
iris = load_iris()
X = pd.DataFrame(iris.data, columns=iris.feature_names)
y = pd.Series(iris.target, name='target')

# Split the dataset into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.2, random_state=ΒΈ10)

# Create and fit the GATree classifier
gatree = GATreeClassifier(n_jobs=16, random_state=32)
gatree.fit(X=X_train, y=y_train, population_size=100, max_iter=100)

# Make predictions on the testing set
y_pred = gatree.predict(X_test)

# Evaluate the accuracy of the classifier
print(accuracy_score(y_test, y_pred))
```

## 🧬 Genetic Operators in `GATree`
The 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.

### Selection
Selection 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.

### Elitism
Elitism 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.

### Crossover

Crossover 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.

### Mutation
Mutation 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.

## πŸ«‚ Community Guidelines
### Contributing
To contribure to the software, please read the [contributing guidelines](./CONTRIBUTING.md).

### Reporting Issues
If 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.

### Seeking Support
If 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).

## πŸ“œ License
This package is distributed under the MIT License. This license can be found online at <http://www.opensource.org/licenses/MIT>.

## Disclaimer
This 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!
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "gatree",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Tadej Lahovnik",
    "author_email": "tadej.lahovnik@student.um.si",
    "download_url": "https://files.pythonhosted.org/packages/23/d0/80065f91a0666c0363b38ddf917d4971e7ba427774cefa3d6d808372ed3e/gatree-0.2.0.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n    <img alt=\"GATree\" src=\".github/images/gatree.png\" width=\"175\" />\n</p>\n\n<h1 align=\"center\">\n    GATree\n</h1>\n\n<p align=\"center\">\n    <img alt=\"PyPI version\" src=\"https://img.shields.io/pypi/v/gatree.svg\" />\n    <img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/gatree.svg\">\n    <a href=\"https://pepy.tech/project/gatree\">\n        <img alt=\"PyPI - Downloads\" src=\"https://img.shields.io/pypi/dm/gatree.svg\">\n    </a>\n    <img alt=\"Downloads\" src=\"https://static.pepy.tech/badge/gatree\">\n    <img alt=\"GATree\" src=\"https://github.com/lahovniktadej/gatree/actions/workflows/test.yml/badge.svg\" />\n    <img alt=\"Documentation status\" src=\"https://readthedocs.org/projects/gatree/badge/?version=latest\" />\n</p>\n\n<p align=\"center\">\n    <img alt=\"Repository size\" src=\"https://img.shields.io/github/repo-size/lahovniktadej/gatree\" />\n    <img alt=\"License\" src=\"https://img.shields.io/github/license/lahovniktadej/gatree.svg\" />\n    <img alt=\"GitHub commit activity\" src=\"https://img.shields.io/github/commit-activity/w/lahovniktadej/gatree.svg\">\n    <a href=\"http://isitmaintained.com/project/lahovniktadej/gatree\">\n        <img alt=\"Percentage of issues still open\" src=\"http://isitmaintained.com/badge/open/lahovniktadej/gatree.svg\">\n    </a>\n    <a href=\"http://isitmaintained.com/project/lahovniktadej/gatree\">\n        <img alt=\"Average time to resolve an issue\" src=\"http://isitmaintained.com/badge/resolution/lahovniktadej/gatree.svg\">\n    </a>\n    <img alt=\"GitHub contributors\" src=\"https://img.shields.io/github/contributors/lahovniktadej/gatree.svg\"/>\n</p>\n\n<p align=\"center\">\n    <a href=\"https://zenodo.org/doi/10.5281/zenodo.13307403\">\n        <img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.13307404.svg\">\n    </a>\n    <a href=\"https://doi.org/10.21105/joss.06748\">\n        <img alt=\"JOSS\" src=\"https://joss.theoj.org/papers/10.21105/joss.06748/status.svg\">\n    </a>\n</p>\n\n<p align=\"center\">\n    <a href=\"#-about\">\ud83d\udccb About </a>  \u2022\n    <a href=\"#-installation\">\ud83d\udce6 Installation</a> \u2022\n    <a href=\"#-usage\">\ud83d\ude80 Usage</a> \u2022\n    <a href=\"#-genetic-operators-in-gatree\">\ud83e\uddec Genetic Operators</a> \u2022\n    <a href=\"#-community-guidelines\">\ud83e\udec2 Community Guidelines</a> \u2022\n    <a href=\"#-license\">\ud83d\udcdc License</a>\n</p>\n\n## \ud83d\udccb 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. \ud83c\udf32\ud83e\uddec\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. \ud83d\ude80\ud83c\udf3f\n\nGATree is currently limited to classification and clustering tasks, with support for regression tasks planned for future releases. \ud83d\udca1\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## \ud83d\udce6 Installation\n### pip\nTo install `GATree` using pip, run the following command:\n```bash\npip install gatree\n```\n\n## \ud83d\ude80 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=\u00b810)\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## \ud83e\uddec 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## \ud83e\udec2 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## \ud83d\udcdc License\nThis package is distributed under the MIT License. This license can be found online at <http://www.opensource.org/licenses/MIT>.\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!",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91a7ab4c2870f15d57ce908f797df4cfbc4e9fb8c7db41e137e6c412eb73739e",
                "md5": "20f2d5b7e5559d8f43c09243d5bf8234",
                "sha256": "5a91ace64d437dd4cf64fd17219b082722ce20b254c2a8effd38d2e62ddfc751"
            },
            "downloads": -1,
            "filename": "gatree-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "20f2d5b7e5559d8f43c09243d5bf8234",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 17491,
            "upload_time": "2024-11-11T10:28:07",
            "upload_time_iso_8601": "2024-11-11T10:28:07.919117Z",
            "url": "https://files.pythonhosted.org/packages/91/a7/ab4c2870f15d57ce908f797df4cfbc4e9fb8c7db41e137e6c412eb73739e/gatree-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23d080065f91a0666c0363b38ddf917d4971e7ba427774cefa3d6d808372ed3e",
                "md5": "9775b9a488902518ff25c390e21b6da0",
                "sha256": "b50536c4dc6a03edcc3a93c8a1222628aabca14fa52bdd3101b786d1c366a216"
            },
            "downloads": -1,
            "filename": "gatree-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9775b9a488902518ff25c390e21b6da0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 12366,
            "upload_time": "2024-11-11T10:28:08",
            "upload_time_iso_8601": "2024-11-11T10:28:08.981940Z",
            "url": "https://files.pythonhosted.org/packages/23/d0/80065f91a0666c0363b38ddf917d4971e7ba427774cefa3d6d808372ed3e/gatree-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-11 10:28:08",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "gatree"
}
        
Elapsed time: 0.33574s