{ "info": { "author": "Franciscp J. Piedrahita", "author_email": "fpiedrah93@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "BDT\n===\n\nThis is a simple library to implement Binary decision Trees.\n\nIn computer science, a binary decision diagram (BDD) or branching\nprogram is a data structure that is used to represent a Boolean\nfunction. On a more abstract level, BDDs can be considered as a\ncompressed representation of sets or relations. Unlike other compressed\nrepresentations, operations are performed directly on the compressed\nrepresentation, i.e. without decompression.\n\nA simple example of this would be the following tree: |alt text|\n\nEach node has a pair of childs, one child is the one associated to its\nfather when the function inside the father returns a true value, and the\nother is associated when the fathers function returns false.\n\nUse\n---\n\nYou can create the nodes manually as python objects like is shown in\nthis example:\n\n.. code:: python\n\n from bdt.tree import BDT\n from bdt.node import Node\n\n\n true_node = Node(\n 'True Node'\n )\n\n false_node = Node(\n 'False Node'\n )\n\n head_node = Node(\n 'Head Node',\n lambda var: var < 10,\n true_child=true_node,\n false_child=false_node\n )\n\n tree = BDT(\n head_node\n )\n\nOther option is to create the tree by passing a python dictionary:\n\n.. code:: python\n\n from bdt.tools import tree_from_dict\n\n\n tree_dict = {\n 'head': 'Head Node',\n\n 'variables': [\n 'withd',\n 'height'\n ],\n\n 'nodes': [\n {\n 'name': 'Head Node',\n 'function': 'withd * height < 50',\n 'true_child': 'True Node',\n 'false_child': 'False Node'\n },\n {\n 'name': 'True Node',\n 'function': 'withd * height < 25',\n 'true_child': 'True True Node',\n 'false_child': 'True False Node'\n },\n {\n 'name': 'False Node',\n 'function': 'withd * height < 100',\n 'true_child': 'False True Node',\n 'false_child': 'False False Node'\n },\n {\n 'name': 'True True Node',\n 'function': 'None',\n 'true_child': 'None',\n 'false_child': 'None'\n },\n {\n 'name': 'True False Node',\n 'function': 'None',\n 'true_child': 'None',\n 'false_child': 'None',\n },\n {\n 'name': 'False True Node',\n 'function': 'None',\n 'true_child': 'None',\n 'false_child': 'None'\n },\n {\n 'name': 'False False Node',\n 'function': 'None',\n 'true_child': 'None',\n 'false_child': 'None'\n },\n ]\n }\n\n tree = tree_from_dict(tree_dict)\n\nAnd the final form would be to load it from a JSON file the matches the\nprevious dictionary and load it by using:\n\n.. code:: python\n\n import json\n\n from bdt.tools import tree_from_json\n\n json_data = open('{PATH_TO_FILE/file.json}', 'r')\n tree = tree_from_json(json_data)\n\nAnd the final form would be to load it from a JSON file the matches the\nprevious dictionary and load it by using:\n\n.. code:: python\n\n import json\n\n from bdt.tools import tree_from_json\n\n json_data = open('{PATH_TO_FILE/file.json}', 'r')\n tree = tree_from_json(json_data)\n\nTo traverse the created tree yo can makeit like this:\n\n.. code:: python\n\n import json\n\n from bdt.tools import tree_from_json\n\n json_data = open('{PATH_TO_FILE/file.json}', 'r')\n tree = tree_from_json(json_data)\n\n tree.set_parameters({\n 'withd': 25,\n 'height': 25\n })\n\n for node in tree:\n print node.name\n\nThe set\\_parameters function let you initialize the values needed to run\nthe boolean functions inside each node.\n\n.. |alt text| image:: https://upload.wikimedia.org/wikipedia/commons/9/91/BDD.png", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fpiedrah/BDT", "keywords": "", "license": "LICENSE", "maintainer": "", "maintainer_email": "", "name": "BDT", "package_url": "https://pypi.org/project/BDT/", "platform": "", "project_url": "https://pypi.org/project/BDT/", "project_urls": { "Homepage": "https://github.com/fpiedrah/BDT" }, "release_url": "https://pypi.org/project/BDT/0.0.3/", "requires_dist": null, "requires_python": "", "summary": "Simple library to write decision trees", "version": "0.0.3" }, "last_serial": 3494480, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "11a82b022176c6f44937f9a998c727de", "sha256": "f6f76ed9cd085d338b55406e5b971b7e7451f81f6b842239d1f361d4f2d3ef47" }, "downloads": -1, "filename": "BDT-0.0.1.tar.gz", "has_sig": false, "md5_digest": "11a82b022176c6f44937f9a998c727de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3550, "upload_time": "2018-01-11T16:00:52", "url": "https://files.pythonhosted.org/packages/d8/7c/19d9ac2697771e70d7d6676867e2edf1e9416747e8e18f5496418d4fee0d/BDT-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "4a9c03c884cf9056bc08f2d73cdc37ec", "sha256": "969acdae1a8e87c2ab8d9ba3605005538f7e444d6ca969c1cbedd2b533231e4f" }, "downloads": -1, "filename": "BDT-0.0.2.tar.gz", "has_sig": false, "md5_digest": "4a9c03c884cf9056bc08f2d73cdc37ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3661, "upload_time": "2018-01-12T16:07:56", "url": "https://files.pythonhosted.org/packages/2f/15/33a4518aca9073986dde5bece8d32b349364a7c6394e45b3c137caaee71f/BDT-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "68e2b5d3fe3f09a53a6ecdad277b8464", "sha256": "cf0df7a54d849a09cb206fd524996055d666808598c2e788bb97b2146f07af6e" }, "downloads": -1, "filename": "BDT-0.0.3.tar.gz", "has_sig": false, "md5_digest": "68e2b5d3fe3f09a53a6ecdad277b8464", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4340, "upload_time": "2018-01-16T15:31:31", "url": "https://files.pythonhosted.org/packages/a8/fc/b02e5964ed69277ff17895e3aa7c557bffafc915f7e75416fd35b76b6225/BDT-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "68e2b5d3fe3f09a53a6ecdad277b8464", "sha256": "cf0df7a54d849a09cb206fd524996055d666808598c2e788bb97b2146f07af6e" }, "downloads": -1, "filename": "BDT-0.0.3.tar.gz", "has_sig": false, "md5_digest": "68e2b5d3fe3f09a53a6ecdad277b8464", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4340, "upload_time": "2018-01-16T15:31:31", "url": "https://files.pythonhosted.org/packages/a8/fc/b02e5964ed69277ff17895e3aa7c557bffafc915f7e75416fd35b76b6225/BDT-0.0.3.tar.gz" } ] }