{ "info": { "author": "Ilan Moscovitz", "author_email": "ilan.moscovitz@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# wittgenstein\n\n_And is there not also the case where we play and--make up the rules as we go along? \n -Ludwig Wittgenstein_\n\n![the duck-rabbit](https://github.com/imoscovitz/wittgenstein/blob/master/duck-rabbit.jpg)\n\n## Summary\n\nThis package implements two iterative coverage-based ruleset algorithms: IREP and RIPPERk.\n\nPerformance is similar to sklearn's DecisionTree CART implementation (see [Performance Tests](https://github.com/imoscovitz/ruleset/blob/master/Performance%20Tests.ipynb)).\n\nFor explanation of the algorithms, see my article in _Towards Data Science_, or the papers below, under [Useful References](https://github.com/imoscovitz/wittgenstein#useful-references).\n\n## Installation\n\nTo install, use\n```bash\n$ pip install wittgenstein\n```\n\nTo uninstall, use\n```bash\n$ pip uninstall wittgenstein\n```\n\n## Requirements\n- pandas\n- numpy\n\n## Usage\n\nUsage syntax is similar to sklearn's. The current version, however, does require that data be passed in as a Pandas DataFrame.\n\nOnce you have loaded and split your data...\n```python\n>>> import pandas as pd\n>>> df = pd.read_csv(dataset_filename)\n>>> from sklearn.model_selection import train_test_split # Or any other mechanism you want to use for data partitioning\n>>> train, test = train_test_split(df, test_size=.33)\n```\nWe can fit a ruleset classifier using RIPPER or IREP.\n```python\n>>> import wittgenstein as lw\n>>> ripper_clf = lw.RIPPER() # Or irep_clf = lw.IREP() to build a model using IREP\n>>> ripper_clf.fit(train, class_feat='Party') # Or call .fit with params train_X, train_y\n>>> ripper_clf\n # Hyperparameter details available in the docstrings and TDS article below\n```\n\nAccess the underlying trained model with the ruleset_ attribute. A ruleset is a disjunction of conjunctions -- 'V' represents 'or'; '^' represents 'and'.\n\nIn other words, the model predicts positive class if any of the inner-nested condition-combinations are all true:\n```python\n>>> ripper_clf.ruleset_\n\n```\nTo score our fit model:\n```python\n>>> test_X = test.drop(class_feat, axis=1)\n>>> test_y = test[class_feat]\n>>> ripper_clf.score(test_X, test_y)\n0.9985686906328078\n```\nDefault scoring metric is accuracy. You can pass in alternate scoring functions, including those available through sklearn:\n```python\nfrom sklearn.metrics import precision_score, recall_score\n>>> precision = clf.score(X_test, y_test, precision_score)\n>>> recall = clf.score(X_test, y_test, recall_score)\n>>> print(f'precision: {precision} recall: {recall})\nprecision: 0.9914..., recall: 0.9953...\n```\nTo perform predictions:\n```python\n>>> ripper_clf.predict(new_data)[:5]\n[True, True, False, True, False]\n```\nWe can also ask our model to tell us why it made each positive prediction that it did:\n```python\n>>> ripper_clf.predict(new_data)[:5]\n([True, True, False, True, True]\n[],\n[,\n ], # This example met multiple sufficient conditions for a positive prediction\n[],\n[],\n[])\n```\n\n## Issues\nIf you encounter any issues, or if you have feedback or improvement requests for how wittgenstein could be made more helpful for you, please post them to [issues](https://github.com/imoscovitz/wittgenstein/issues), and I'll respond.\n\n## Contributing\nContributions are welcome! If you are interested in contributing, let me know at ilan.moscovitz@gmail.com or on [linkedin](https://www.linkedin.com/in/ilan-moscovitz/).\n\n## Useful references\n- [My article in _Towards Data Science_ explaining IREP, RIPPER, and wittgenstein](https://towardsdatascience.com/how-to-perform-explainable-machine-learning-classification-without-any-trees-873db4192c68)\n- [Furnkrantz-Widmer IREP paper](https://pdfs.semanticscholar.org/f67e/bb7b392f51076899f58c53bf57d5e71e36e9.pdf)\n- [Cohen's RIPPER paper](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.107.2612&rep=rep1&type=pdf)\n- [Partial decision trees](https://researchcommons.waikato.ac.nz/bitstream/handle/10289/1047/uow-cs-wp-1998-02.pdf?sequence=1&isAllowed=y)\n- [Bayesian Rulesets](https://pdfs.semanticscholar.org/bb51/b3046f6ff607deb218792347cb0e9b0b621a.pdf)\n- [C4.5 paper including all the gory details on MDL](https://pdfs.semanticscholar.org/cb94/e3d981a5e1901793c6bfedd93ce9cc07885d.pdf)\n- [_Philosophical Investigations_](https://static1.squarespace.com/static/54889e73e4b0a2c1f9891289/t/564b61a4e4b04eca59c4d232/1447780772744/Ludwig.Wittgenstein.-.Philosophical.Investigations.pdf)", "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/imoscovitz/wittgenstein", "keywords": "Classification,Decision Rule,Machine Learning,Explainable Machine Learning,Data Science", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "wittgenstein", "package_url": "https://pypi.org/project/wittgenstein/", "platform": "", "project_url": "https://pypi.org/project/wittgenstein/", "project_urls": { "Homepage": "https://github.com/imoscovitz/wittgenstein" }, "release_url": "https://pypi.org/project/wittgenstein/0.1.6/", "requires_dist": null, "requires_python": "", "summary": "Ruleset covering algorithms for explainable machine learning", "version": "0.1.6" }, "last_serial": 5162546, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "54f91a9bc3c2a9440ecf7a7995cef408", "sha256": "1ea346cc61507acadce770c997ae3a1d904810021dcf8a6156f89147dafdc0c9" }, "downloads": -1, "filename": "wittgenstein-0.1.0-py3.6.egg", "has_sig": false, "md5_digest": "54f91a9bc3c2a9440ecf7a7995cef408", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 89550, "upload_time": "2019-02-22T00:30:27", "url": "https://files.pythonhosted.org/packages/37/12/f7c9687075918710b9bb6b42f904273c14719bb5dfa54537fe3e83575cf8/wittgenstein-0.1.0-py3.6.egg" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "af4b72a876ace503e9440a7c102cbd17", "sha256": "a26106974c3dc27a5876d5af43e0c8d1d0b5fcf22405371008863bc35aedd0b5" }, "downloads": -1, "filename": "wittgenstein-0.1.1-py3.6.egg", "has_sig": false, "md5_digest": "af4b72a876ace503e9440a7c102cbd17", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 89619, "upload_time": "2019-02-22T00:30:36", "url": "https://files.pythonhosted.org/packages/70/3d/54998f3a5e2c70d1dc56e55bd1bca08a3874ef00e74b3aec2028620f2318/wittgenstein-0.1.1-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "c244bb169d2cc4707780daa7f7c199db", "sha256": "7d38d20829ecdc24cd7de429c4bf6d5a71c4a784532e3d4e3bf32b8231493781" }, "downloads": -1, "filename": "wittgenstein-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c244bb169d2cc4707780daa7f7c199db", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 41659, "upload_time": "2019-02-22T00:30:24", "url": "https://files.pythonhosted.org/packages/99/4d/605574f34dc898df686708a54d6671737e9058822bcb7204bffea7a148c2/wittgenstein-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "00cfd6de665a6806885e28611c7b9f6d", "sha256": "08571897fea9958e6f695d330177a28db3b056025b104fa450c2c4a02752d3ff" }, "downloads": -1, "filename": "wittgenstein-0.1.1.tar.gz", "has_sig": false, "md5_digest": "00cfd6de665a6806885e28611c7b9f6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19775, "upload_time": "2019-02-22T00:30:40", "url": "https://files.pythonhosted.org/packages/67/b8/151a6e3da17cd81e050e25748a1823ae369ecc6af300cc269f6f950c1abf/wittgenstein-0.1.1.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "e9664abb95b17e6e3a6402783db9a3f5", "sha256": "246ee4189c8a2dc238f42142816a16db476d48bcf0fd7f6f10a2824511ab7876" }, "downloads": -1, "filename": "wittgenstein-0.1.3.tar.gz", "has_sig": false, "md5_digest": "e9664abb95b17e6e3a6402783db9a3f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20522, "upload_time": "2019-03-05T01:20:50", "url": "https://files.pythonhosted.org/packages/0c/c4/f0675a3fce7c6156c7781b4e256e6726889052f95a0b52da65a046733ae8/wittgenstein-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "8055da240d54a91b51aa5ac009f76edf", "sha256": "4979233ad7e1e8488e37b5292e15548b080083aae620b94deaf94b7a375942ad" }, "downloads": -1, "filename": "wittgenstein-0.1.4.tar.gz", "has_sig": false, "md5_digest": "8055da240d54a91b51aa5ac009f76edf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20526, "upload_time": "2019-03-05T01:32:37", "url": "https://files.pythonhosted.org/packages/04/eb/f03311eb9c03e9338bf0247511feab2ff82d4914ee064d0742de2c4e8b4f/wittgenstein-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "8f3ee2817f8ee47bcbebc2f8a4daba15", "sha256": "27fea9027bc323273d0764914dcb2fde343283696b1572a66df708815acdd748" }, "downloads": -1, "filename": "wittgenstein-0.1.5.tar.gz", "has_sig": false, "md5_digest": "8f3ee2817f8ee47bcbebc2f8a4daba15", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20742, "upload_time": "2019-03-07T00:42:14", "url": "https://files.pythonhosted.org/packages/dc/50/541bfb656bebc21a2b0112affdd47b6954abf093e9b3d2d378baee3599ac/wittgenstein-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "a415f9bcebbb2d7d3c8be90fca9305ba", "sha256": "7f6865af4135b5039ca4461a1b9c5b210ec604c6c60a23fd6c7fe76e1f9643b7" }, "downloads": -1, "filename": "wittgenstein-0.1.6.tar.gz", "has_sig": false, "md5_digest": "a415f9bcebbb2d7d3c8be90fca9305ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25316, "upload_time": "2019-04-18T23:14:27", "url": "https://files.pythonhosted.org/packages/09/fb/35564fb8efa80ab7b690c0312bb73af10892993e8f6d4930b8e6fd87dec4/wittgenstein-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a415f9bcebbb2d7d3c8be90fca9305ba", "sha256": "7f6865af4135b5039ca4461a1b9c5b210ec604c6c60a23fd6c7fe76e1f9643b7" }, "downloads": -1, "filename": "wittgenstein-0.1.6.tar.gz", "has_sig": false, "md5_digest": "a415f9bcebbb2d7d3c8be90fca9305ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25316, "upload_time": "2019-04-18T23:14:27", "url": "https://files.pythonhosted.org/packages/09/fb/35564fb8efa80ab7b690c0312bb73af10892993e8f6d4930b8e6fd87dec4/wittgenstein-0.1.6.tar.gz" } ] }