{ "info": { "author": "Gary Marigliano", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "# LFA Toolbox\n\nLFA Toolbox is a set of tools to create, view and play with fuzzy systems. Ideal for students to play with fuzzy systems.\n\nFor example a simple example of a fuzzy system to determine if there will be\na lot of tourists given the temperature and the amount of sunshine.\n\n* IF (temperature is hot OR sunshine is sunny), THEN (tourists is high)\n* IF (temperature is warm AND sunshine is part_sunny), THEN (tourists is medium)\n* IF (temperature is cold OR sunshine is cloudy), THEN (tourists is low)\n\n![resort_problem](assets/img/resort_problem.png)\n\n## Installation\n\nThe detailed install instructions can be found here [docs/INSTALL.md](docs/INSTALL.md) but\nyou basically need to do:\n\n`pip install lfa-toolbox`\n\n## Features\n\n* Singleton and Mamdani fuzzy system types\n* Commonly used membership functions (Trap. MF, Triangle MF, Free shape MF,..)\n* Multiple consequents\n* Default rule\n* NOT conditions\n* Viewers (membership function viewer, linguistic variable viewer,...)\n\n## Examples\n\n### Membership functions\n\n**TODO** hand-crafted mf + triangular mf + linPWMF + screenshot viewer\n\n```python\nfrom matplotlib import pyplot as plt\n\nfrom lfa_toolbox.core.mf.triangular_mf import TriangularMF\nfrom lfa_toolbox.view.mf_viewer import MembershipFunctionViewer\n\n# Create a matplotlib plot\nfig, ax = plt.subplots()\n\n# Create a triangular membership function\ntemp_mf = TriangularMF(-20, 25, 40)\n\n# You can fuzzify an input value\nfuzzified_value = temp_mf.fuzzify(22.5)\nprint(\"MF has been fuzzified to {:.3f}\".format(fuzzified_value))\n\n# Or you can visualize the MF using matplotlib\nmfv = MembershipFunctionViewer(temp_mf, ax=ax,\n label=\"Temperature in celsius\")\nmfv.fuzzify(22.5)\n\nplt.legend() # optionally show the legend i.e. \"Temperature\"\nplt.show()\n```\n\nAnd the output will be:\n\n![temp_mf](assets/img/temp_mf.png)\n\nOthers shapes of membership functions can be created such as:\n\n![mfs](assets/img/mfs.png)\n\nCode for this visualization is available at [/lfa_toolbox/examples/readme_examples.py](/lfa_toolbox/examples/readme_examples.py).\n\n### Linguistic variable\n\n**TODO** hand-crafted lv + three points lv + p points lv + screenshot viewer\n\nYou can create and visualize linguistic variables by specifing labels and\nmembership functions for each label.\n\n```python\nfrom matplotlib import pyplot as plt\nfrom lfa_toolbox.core.lv.linguistic_variable import LinguisticVariable\nfrom lfa_toolbox.view.lv_viewer import LinguisticVariableViewer\n\nfig, axs = plt.subplots(3, figsize=(12, 8))\n\nfor ax in axs:\nlv_temp = LinguisticVariable(\n name=\"temperature\",\n ling_values_dict={\n \"cold\": LinPWMF([17, 1], [20, 0]),\n \"warm\": LinPWMF([17, 0], [20, 1], [26, 1], [29, 0]),\n \"hot\": LinPWMF([26, 0], [29, 1]),\n },\n)\nviewer = LinguisticVariableViewer(lv_temp, ax=ax)\nviewer.fuzzify(26.6)\nviewer.fuzzify(21.8)\n\nfig.tight_layout()\nplt.show()\n```\n\n![lv_temp](/assets/img/lv_temp.png)\n\nYou can also use the class `PPointsLV` to create interpretable more\nconveniently.\n\n```python\nfrom matplotlib import pyplot as plt\nfrom lfa_toolbox.view.lv_viewer import LinguisticVariableViewer\nfrom lfa_toolbox.core.lv.p_points_lv import PPointsLV\n\nfig, ax = plt.subplots()\n# PPointsLV helps you create a linguistic variable that is human\n# interpretable and generate automatically fuzzy labels for you.\nlv = PPointsLV(\"Github stars\", [0, 50, 300, 1000])\nLinguisticVariableViewer(lv, ax=ax)\n\nplt.show()\n```\n\n![ppointslv](/assets/img/ppointslv.png)\n\n### Fuzzy System\n\nYou can create an entire fuzzy system by hand. LFA Toolbox supports Singleton\nand Mamdani fuzzy systems, default rule and NOT conditions. You can see how it\nworks by looking at the examples here [/lfa_toolbox/examples](/lfa_toolbox/examples).\n\nTake a look at the [`car_problem_slides`](/lfa_toolbox/examples/car_problem_slides) folder.\nIt shows a problem where we want to regulate the push of a pedal to maintain\nthe speed of a car. It starts with a Mamdani fuzzy system and gradually\nsimplifies it by first replacing it with a Singleton fuzzy system, then by\nadding a default fuzzy rule and finally by using NOT conditions.\n\n## Integration with Trefle\n\n[Trefle](https://github.com/krypty/trefle) is a scikit-learn compatible\nestimator implementing the FuzzyCoCo algorithm that uses a cooperative\ncoevolution algorithm to find and build interpretable fuzzy systems.\n\nSee [Trefle's Github](https://github.com/krypty/trefle) to learn how to\ninstall it.\n\nBasically after running Trefle you can save the best fuzzy system and fine tune\nit with LFA Toolbox. For example you can change the values of the membership\nfunctions or remove a too specific fuzzy rule.\n\nSee [/lfa_toolbox/examples/import_a_trefle_fuzzy_system.py](/lfa_toolbox/examples/import_a_trefle_fuzzy_system.py) example.\n\n## Deployment and Tests\n\nBoth documentations are available in the `docs` folder.\n\n\n## Credits\n\n* Gary Marigliano (developper)\n* Carlos Andr\u00e9s PE\u00d1A REYES (project manager)\n* [CI4CB Team](http://iict-space.heig-vd.ch/cpn/)\n\n![ci4cb_logo](assets/img/ci4cb_logo.png)\n![heigvd_logo](assets/img/heigvd_logo.png)\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://iict-space.heig-vd.ch/cpn/", "keywords": "", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "lfa-toolbox", "package_url": "https://pypi.org/project/lfa-toolbox/", "platform": "", "project_url": "https://pypi.org/project/lfa-toolbox/", "project_urls": { "Homepage": "http://iict-space.heig-vd.ch/cpn/" }, "release_url": "https://pypi.org/project/lfa-toolbox/0.2/", "requires_dist": [ "numpy (>=1.10)", "matplotlib (>=2.1.1)" ], "requires_python": ">=3.5", "summary": "LFA Toolbox is an educational library to play with fuzzy systems", "version": "0.2" }, "last_serial": 4690765, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "deb715a2efda0f5fc65c6c4bf7b5c574", "sha256": "ce3d22e5c58deeef50323f990c60a3ddd3dc81f3dd3547298f6666d36213dbf3" }, "downloads": -1, "filename": "lfa_toolbox-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "deb715a2efda0f5fc65c6c4bf7b5c574", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 56848, "upload_time": "2019-01-13T13:49:10", "url": "https://files.pythonhosted.org/packages/d7/ea/8b30f42528802f58b09cb8a6bb149e23b363afdc7b64113a76a7abe677dc/lfa_toolbox-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b2af92243bd234ee5b4d587096ab8543", "sha256": "1081eab4c7ae6eea426a6bf5319240f5143e7072f8a1b1f5ee1f6f10d424a396" }, "downloads": -1, "filename": "lfa_toolbox-0.2.tar.gz", "has_sig": false, "md5_digest": "b2af92243bd234ee5b4d587096ab8543", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 26471, "upload_time": "2019-01-13T13:49:12", "url": "https://files.pythonhosted.org/packages/04/dd/91355e83db5523b1891489e19299554f4d79a0c7fa3ab273b174c7001780/lfa_toolbox-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "deb715a2efda0f5fc65c6c4bf7b5c574", "sha256": "ce3d22e5c58deeef50323f990c60a3ddd3dc81f3dd3547298f6666d36213dbf3" }, "downloads": -1, "filename": "lfa_toolbox-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "deb715a2efda0f5fc65c6c4bf7b5c574", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 56848, "upload_time": "2019-01-13T13:49:10", "url": "https://files.pythonhosted.org/packages/d7/ea/8b30f42528802f58b09cb8a6bb149e23b363afdc7b64113a76a7abe677dc/lfa_toolbox-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b2af92243bd234ee5b4d587096ab8543", "sha256": "1081eab4c7ae6eea426a6bf5319240f5143e7072f8a1b1f5ee1f6f10d424a396" }, "downloads": -1, "filename": "lfa_toolbox-0.2.tar.gz", "has_sig": false, "md5_digest": "b2af92243bd234ee5b4d587096ab8543", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 26471, "upload_time": "2019-01-13T13:49:12", "url": "https://files.pythonhosted.org/packages/04/dd/91355e83db5523b1891489e19299554f4d79a0c7fa3ab273b174c7001780/lfa_toolbox-0.2.tar.gz" } ] }