deeptree


Namedeeptree JSON
Version 0.0.2 PyPI version JSON
download
home_page
SummaryDecision tree classifier implemented using gini index splitting
upload_time2023-02-06 04:15:03
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) 2023 Alan Abraham Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords cart classifier continuous features decision tree discrete features gini index no dependencies
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DEEPTREE
A simple Decision Tree Classifier

## Overview

This project is a custom implementation of a decision tree classifier inspired from [scikit-learn-decision-tree-classifier](https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html). The classifier is built from scratch without any external dependencies.

Gini index is used by the classifier to construct the decision tree. Using the gini index for partitioning has allowed the classifier to handle both continuous and categorical features. This allows the classifier to be used in a wider range of applications and datasets.

In addition, the classifier also includes a basic tree printing functionality, which can be used to visualize the tree structure and gain a better understanding of how the classifier is making its decisions.

## Features

* No external dependencies
* Handles both continuous and categorical features
* Uses Gini index to measure impurity of partion
* Includes basic tree printing functionality for tree visualization

# Requirements

Python 3.x
[Optional] Any text editor or IDE of your choice for editing the code.

# Installation

deeptree can be installed using the following command:

```
pip install deeptree
```
or
```
pip3 install deeptree
```

# Dependencies

deeptree is built using only in built python libraries.

## Functionalities

The functions in deeptree package come as part of two classes Node and Classifier. The functions are:-

### deeptree.Node.get_feature_midpoints(i=0)

This function finds the midpoints for any continuous feature corresponding to index 'i' in the dataset.

### deeptree.Node.get_splitting_subsets(i=0)

This function finds the splitting subsets for any discrete feature corresponding to index 'i' in the dataset.

### deeptree.Node.get_gini_value()

This function calculates the gini value of the deeptree node.

### deeptree.Classifier.fit(dataset=[],label_index=-1)

This function trains the decision tree classifier on the given dataset.

### deeptree.Classifier.predict(dataset=[]):

This function predicts the labels/classes of the given dataset.

### deeptree.Classifier.print_tree(node, level=0)
        
This function prints the structure of the decision tree with the details at each node.


Example on how to use deeptree are provided in example.py. The example is based on the [iris.data](https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data) dataset downloaded from [UCI achine learning repository](https://archive.ics.uci.edu/ml/index.php).

## License

MIT License

## Acknowledgments

The source code for this project was created as part of one of the courseworks for MSc. Data Science program at Lancaster University. Thanks to Leandro Soriano Marcolino for his amazing classes and this coursework topic.
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "deeptree",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "CART,classifier,continuous features,decision tree,discrete features,gini index,no dependencies",
    "author": "",
    "author_email": "Alan Abraham <alan.abraham.tm@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/57/ee/199aae996e87d72e0fece3d7dfb25d98e114378d2d8d43d6bbba245ffff2/deeptree-0.0.2.tar.gz",
    "platform": null,
    "description": "# DEEPTREE\nA simple Decision Tree Classifier\n\n## Overview\n\nThis project is a custom implementation of a decision tree classifier inspired from [scikit-learn-decision-tree-classifier](https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html). The classifier is built from scratch without any external dependencies.\n\nGini index is used by the classifier to construct the decision tree. Using the gini index for partitioning has allowed the classifier to handle both continuous and categorical features. This allows the classifier to be used in a wider range of applications and datasets.\n\nIn addition, the classifier also includes a basic tree printing functionality, which can be used to visualize the tree structure and gain a better understanding of how the classifier is making its decisions.\n\n## Features\n\n* No external dependencies\n* Handles both continuous and categorical features\n* Uses Gini index to measure impurity of partion\n* Includes basic tree printing functionality for tree visualization\n\n# Requirements\n\nPython 3.x\n[Optional] Any text editor or IDE of your choice for editing the code.\n\n# Installation\n\ndeeptree can be installed using the following command:\n\n```\npip install deeptree\n```\nor\n```\npip3 install deeptree\n```\n\n# Dependencies\n\ndeeptree is built using only in built python libraries.\n\n## Functionalities\n\nThe functions in deeptree package come as part of two classes Node and Classifier. The functions are:-\n\n### deeptree.Node.get_feature_midpoints(i=0)\n\nThis function finds the midpoints for any continuous feature corresponding to index 'i' in the dataset.\n\n### deeptree.Node.get_splitting_subsets(i=0)\n\nThis function finds the splitting subsets for any discrete feature corresponding to index 'i' in the dataset.\n\n### deeptree.Node.get_gini_value()\n\nThis function calculates the gini value of the deeptree node.\n\n### deeptree.Classifier.fit(dataset=[],label_index=-1)\n\nThis function trains the decision tree classifier on the given dataset.\n\n### deeptree.Classifier.predict(dataset=[]):\n\nThis function predicts the labels/classes of the given dataset.\n\n### deeptree.Classifier.print_tree(node, level=0)\n        \nThis function prints the structure of the decision tree with the details at each node.\n\n\nExample on how to use deeptree are provided in example.py. The example is based on the [iris.data](https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data) dataset downloaded from [UCI achine learning repository](https://archive.ics.uci.edu/ml/index.php).\n\n## License\n\nMIT License\n\n## Acknowledgments\n\nThe source code for this project was created as part of one of the courseworks for MSc. Data Science program at Lancaster University. Thanks to Leandro Soriano Marcolino for his amazing classes and this coursework topic.",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Alan Abraham  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Decision tree classifier implemented using gini index splitting",
    "version": "0.0.2",
    "split_keywords": [
        "cart",
        "classifier",
        "continuous features",
        "decision tree",
        "discrete features",
        "gini index",
        "no dependencies"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4fb721fbc805359d2c198c3991f650f465750c8e3a7aa14a942b412aa1e5735a",
                "md5": "bfcdce90811d3e53c14614769096e030",
                "sha256": "deea7b2158a2491a73e85e029e8257b9a8aed41092792ad79109e19cad1228fd"
            },
            "downloads": -1,
            "filename": "deeptree-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bfcdce90811d3e53c14614769096e030",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8619,
            "upload_time": "2023-02-06T04:15:01",
            "upload_time_iso_8601": "2023-02-06T04:15:01.613663Z",
            "url": "https://files.pythonhosted.org/packages/4f/b7/21fbc805359d2c198c3991f650f465750c8e3a7aa14a942b412aa1e5735a/deeptree-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57ee199aae996e87d72e0fece3d7dfb25d98e114378d2d8d43d6bbba245ffff2",
                "md5": "02eac88718c529d5a6eb9178cad0c87c",
                "sha256": "dc87a0d1424d75f75db14aae56457177fb9cd94597b501d74a2de6b35189826f"
            },
            "downloads": -1,
            "filename": "deeptree-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "02eac88718c529d5a6eb9178cad0c87c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8288,
            "upload_time": "2023-02-06T04:15:03",
            "upload_time_iso_8601": "2023-02-06T04:15:03.424367Z",
            "url": "https://files.pythonhosted.org/packages/57/ee/199aae996e87d72e0fece3d7dfb25d98e114378d2d8d43d6bbba245ffff2/deeptree-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-06 04:15:03",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "deeptree"
}
        
Elapsed time: 0.03604s