{ "info": { "author": "Majid Rafiei", "author_email": "majid.rafiei@pads.rwth-aachen.de", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Visual Decision Tree Based on Categorical Attributes \n-------------------\n\nAs you may know \"scikit-learn\" library in python is not able to make a decision tree based on categorical data, and you have to convert categorical data to numerical before passing them to the classifier method. Also, the resulted decision tree is a binary tree while a decision tree does not need to be binary.\n\nHere, we provide a library which is able to make a visual decision tree based on categorical data. You can read more about decision trees [here](https://en.wikipedia.org/wiki/Decision_tree).\n\n## Features\n--------------------\n\nThe main algorithm which is used is ID3 with the following features:\n\n* Information gain based on [entropy](https://en.wikipedia.org/wiki/Decision_tree_learning)\n* Information gain based on [gini](https://en.wikipedia.org/wiki/Decision_tree_learning)\n* Some pruning capabilities like:\n\t* Minimum number of samples\n\t* Minimum information gain\n* The resulted tree is not binary\n\n## Requirements\n--------------------\n\nYou can find all the requirements in \"requirements.txt\" file, and it can be installed easily by the following command:\n\n* pip install -r requirements.txt \n\nAlso to be able to see visual tree, you need to install graphviz package. [Here](https://www.graphviz.org/download/) you can find the right package with respect to your operation system. \n\n\n## Usage\n--------------------\n\n```python\n\nfrom p_decision_tree.DecisionTree import DecisionTree\nimport pandas as pd\n\n#Reading CSV file as data set by Pandas\ndata = pd.read_csv('playtennis.csv')\ncolumns = data.columns\n\n#All columns except the last one are descriptive by default\ndescriptive_features = columns[:-1]\n#The last column is considered as label\nlabel = columns[-1]\n\n#Converting all the columns to string\nfor column in columns:\n data[column]= data[column].astype(str)\n\ndata_descriptive = data[descriptive_features].values\ndata_label = data[label].values\n\n#Calling DecisionTree constructor (the last parameter is criterion which can also be \"gini\")\ndecisionTree = DecisionTree(data_descriptive.tolist(), descriptive_features.tolist(), data_label.tolist(), \"entropy\")\n\n#Here you can pass pruning features (gain_threshold and minimum_samples)\ndecisionTree.id3(0,0)\n\n#Visualizing decision tree by Graphviz\ndot = decisionTree.print_visualTree( render=True )\n\n# When using Jupyter\n#display( dot )\n\nprint(\"System entropy: \", format(decisionTree.entropy))\nprint(\"System gini: \", format(decisionTree.gini))\n\n\n\n``` \n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/m4jidRafiei/Decision-Tree-Python-", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "p-decision-tree", "package_url": "https://pypi.org/project/p-decision-tree/", "platform": "", "project_url": "https://pypi.org/project/p-decision-tree/", "project_urls": { "Homepage": "https://github.com/m4jidRafiei/Decision-Tree-Python-", "Source": "https://github.com/m4jidRafiei/Decision-Tree-Python-" }, "release_url": "https://pypi.org/project/p-decision-tree/0.0.2/", "requires_dist": [ "graphviz (==0.9)", "pandas (==0.24.2)" ], "requires_python": "", "summary": "Visual Decision Tree Based on Categorical Attributes Package", "version": "0.0.2" }, "last_serial": 5752134, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "a46237529e933cca407bc9ff6c664cda", "sha256": "b0c71b19b3fbe0dedf42fbc1fa9b4a9442a70a7a7ec67ec75b0274df86418ca0" }, "downloads": -1, "filename": "p_decision_tree-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "a46237529e933cca407bc9ff6c664cda", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6112, "upload_time": "2019-08-29T11:56:20", "url": "https://files.pythonhosted.org/packages/6c/61/c41c65daa96b188bf2511c06cac43de244ef7271622a6fc99f9bb8311201/p_decision_tree-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06e3d54f43aba8aa0ca2afc3453e329c", "sha256": "e86f8a17860145bca70ebd07c955c41f7f6c10c33c201b60087c20947b05d80d" }, "downloads": -1, "filename": "p_decision_tree-0.0.1.tar.gz", "has_sig": false, "md5_digest": "06e3d54f43aba8aa0ca2afc3453e329c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4683, "upload_time": "2019-08-29T11:56:23", "url": "https://files.pythonhosted.org/packages/22/53/572b0c14e9a87eda783637fe4bb81676a02bcfa62074a22cc08e2968032b/p_decision_tree-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "10c9b2f947eeef8847a049de0db9608b", "sha256": "15534dbc2aa70829b023623dd2f4eda4517ecb56f88c7b215bf5fbe912879e4d" }, "downloads": -1, "filename": "p_decision_tree-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "10c9b2f947eeef8847a049de0db9608b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6115, "upload_time": "2019-08-29T12:34:37", "url": "https://files.pythonhosted.org/packages/e2/af/36b82b24bf5527bb6a210cc6d9ab6e6b849a94882f604f8bc845b4a5075e/p_decision_tree-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d786b31495e66256f63e3a7a6c1d1caa", "sha256": "3bf1655ac32acb2c4d0358d9fa4b2e5d3ca4d3388c8718c26068ef4f32cfacac" }, "downloads": -1, "filename": "p_decision_tree-0.0.2.tar.gz", "has_sig": false, "md5_digest": "d786b31495e66256f63e3a7a6c1d1caa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4675, "upload_time": "2019-08-29T12:34:39", "url": "https://files.pythonhosted.org/packages/27/0e/827b88637fdec71974dc26f1b1a4179865357ad0a1cf285e9dfb986f2278/p_decision_tree-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "10c9b2f947eeef8847a049de0db9608b", "sha256": "15534dbc2aa70829b023623dd2f4eda4517ecb56f88c7b215bf5fbe912879e4d" }, "downloads": -1, "filename": "p_decision_tree-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "10c9b2f947eeef8847a049de0db9608b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6115, "upload_time": "2019-08-29T12:34:37", "url": "https://files.pythonhosted.org/packages/e2/af/36b82b24bf5527bb6a210cc6d9ab6e6b849a94882f604f8bc845b4a5075e/p_decision_tree-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d786b31495e66256f63e3a7a6c1d1caa", "sha256": "3bf1655ac32acb2c4d0358d9fa4b2e5d3ca4d3388c8718c26068ef4f32cfacac" }, "downloads": -1, "filename": "p_decision_tree-0.0.2.tar.gz", "has_sig": false, "md5_digest": "d786b31495e66256f63e3a7a6c1d1caa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4675, "upload_time": "2019-08-29T12:34:39", "url": "https://files.pythonhosted.org/packages/27/0e/827b88637fdec71974dc26f1b1a4179865357ad0a1cf285e9dfb986f2278/p_decision_tree-0.0.2.tar.gz" } ] }