{ "info": { "author": "Ami Tavory, Shahar Azulay, Tali Raveh-Sadka", "author_email": "atavory@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Information Analysis" ], "description": "Ibex\n====\n\n\nAmi Tavory, Shahar Azulay, Tali Raveh-Sadka\n\n.. image:: https://travis-ci.org/atavory/ibex.svg?branch=master \n :target: https://travis-ci.org/atavory/ibex\n\n.. image:: https://landscape.io/github/atavory/ibex/master/landscape.svg?style=flat\n :target: https://landscape.io/github/atavory/ibex/master\n\n.. image:: https://img.shields.io/codecov/c/github/atavory/ibex/master.svg\n :target: https://codecov.io/gh/atavory/ibex/\n\n.. image:: http://readthedocs.org/projects/ibex/badge/?version=latest \n :target: http://ibex.readthedocs.io/en/latest/index.html\n\n.. image:: https://img.shields.io/badge/license-BSD--3--Clause-brightgreen.svg\n :target: https://raw.githubusercontent.com/atavory/ibex/master/LICENSE.txt\n\n.. image:: https://badge.fury.io/py/ibex.svg\n :target: https://badge.fury.io/py/ibex\n\n\nThis library aims for two (somewhat independent) goals:\n\n* providing `pandas `_ adapters for `estimators conforming to the scikit-learn protocol `_, in particular those of `scikit-learn `_ itself\n\n* providing easier, and more succinct ways of combining estimators, features, and pipelines\n\n(You might also want to check out the excellent `pandas-sklearn `_ which has the same aims, but takes a very different \napproach.)\n\nThe full documentation at |rtd_ibex|_ defines these matters in detail, but the library has an extremely-small `interface `_.\n\n\n.. |rtd_ibex| image:: http://ibex.readthedocs.io/en/latest/_static/read_the_docs.png\n.. _rtd_ibex: https://atavory.github.io/ibex/\n\n\nTL;DR\n-----\n\nThe following short example shows the main points of the library. It is an adaptation of the scikit-learn example `Concatenating multiple feature extraction methods `_. In this example, we build a classifier for the `iris dataset `_ using a combination of `PCA `_, `univariate feature selection `_, and a `support vecor machine classifier `_.\n\nWe first load the Iris dataset into a pandas ``DataFrame``.\n\n >>> import numpy as np\n >>> from sklearn import datasets\n >>> import pandas as pd\n >>> \n >>> iris = datasets.load_iris()\n >>> features, targets, iris = iris['feature_names'], iris['target_names'], pd.DataFrame(\n ... np.c_[iris['data'], iris['target']],\n ... columns=iris['feature_names']+['class'])\n >>> iris['class'] = iris['class'].map(pd.Series(targets))\n >>> \n >>> iris.head()\n sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) \\\n 0 5.1 3.5 1.4 0.2\n 1 4.9 3.0 1.4 0.2\n 2 4.7 3.2 1.3 0.2\n 3 4.6 3.1 1.5 0.2\n 4 5.0 3.6 1.4 0.2\n \n\tclass\n 0 setosa\n 1 setosa\n 2 setosa\n 3 setosa\n 4 setosa\n\n\nNow, we import the relevant steps. Note that, in this example, we import them from `ibex.sklearn` rather than `sklearn`.\n\n\t>>> from ibex.sklearn.svm import SVC as PdSVC\n\t>>> from ibex.sklearn.feature_selection import SelectKBest as PdSelectKBest\n\t>>> from ibex.sklearn.decomposition import PCA as PdPCA\n\n(Of course, it's possible to import steps from `sklearn` as well, and use them alongside and together with the steps of `ibex.sklearn`.)\n\nFinally, we construct a pipeline that, given a ``DataFrame`` of features:\n\n* horizontally concatenates a 2-component PCA ``DataFrame``, and the best-feature ``DataFrame``, to a resulting ``DataFrame`` \n* then, passes the result to a support-vector machine classifier outputting a pandas series:\n\n\n\t>>> clf = PdPCA(n_components=2) + PdSelectKBest(k=1) | PdSVC(kernel=\"linear\")\n\n``clf`` is now a ``pandas``-ware classifier, but otherwise can be used pretty much like all ``sklearn`` estimator. For example, \n\n >>> param_grid = dict(\n ... featureunion__pca__n_components=[1, 2, 3],\n ... featureunion__selectkbest__k=[1, 2],\n ... svc__C=[0.1, 1, 10])\n >>> try:\n ... from ibex.sklearn.model_selection import GridSearchCV as PdGridSearchCV\n ... except: # Accomodate older versions of sklearn\n ... from ibex.sklearn.grid_search import GridSearchCV as PdGridSearchCV\n >>> PdGridSearchCV(clf, param_grid=param_grid).fit(iris[features], iris['class']) # doctest: +SKIP \n ...\n\nSo what does this add to the original version?\n\n#. The estimators perform `verification and processing `_ on the inputs and outputs. They verify column names following calls to ``fit``, and index results according to those of the inputs. This helps catch bugs.\n\n#. The results are much more interpretable:\n\n >>> svc = PdSVC(kernel=\"linear\", probability=True)\n\n\tFind the coefficients of the boundaries between the different classes:\n\n >>> svc.fit(iris[features], iris['class']).coef_\n sepal length (cm) sepal width (cm) petal length (cm) \\\n setosa -0.046259 0.521183 -1.003045\n versicolor -0.007223 0.178941 -0.538365\n virginica 0.595498 0.973900 -2.031000\n \n petal width (cm)\n setosa -0.464130\n versicolor -0.292393\n virginica -2.006303\n\n\tPredict belonging to classes:\n\n >>> svc.fit(iris[features], iris['class']).predict_proba(iris[features])\n setosa versicolor virginica\n 0 0.97... 0.01... 0.00...\n ...\n\n\tFind the coefficients of the boundaries between the different classes in a pipeline:\n\n >>> clf = PdPCA(n_components=2) + PdSelectKBest(k=1) | svc\n >>> clf = clf.fit(iris[features], iris['class'])\n >>> svc.coef_\n pca selectkbest\n comp_0 comp_1 petal length (cm)\n setosa -0.757016 ...0.376680 -0.575197\n versicolor -0.351218 ...0.141699 -0.317562\n virginica -1.529320 ...1.472771 -1.509391\n\n#. It allows `writinfitg Pandas-munging estimators `_ (see also `Multiple-Row Features In The Movielens Dataset `_).\n\n#. Using ``DataFrame`` metadata, it allows writing more complex meta-learning algorithms, such as stacking and nested labeled and stratified cross validation.\n\n#. The pipeline syntax is succinct and clear (see `Motivation For Shorter Combinations `_).\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/atavory/ibex", "keywords": "", "license": "bsd", "maintainer": "", "maintainer_email": "", "name": "ibex", "package_url": "https://pypi.org/project/ibex/", "platform": "", "project_url": "https://pypi.org/project/ibex/", "project_urls": { "Homepage": "https://github.com/atavory/ibex" }, "release_url": "https://pypi.org/project/ibex/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "Pandas Adapters For Scikit-Learn", "version": "0.1.3" }, "last_serial": 3787644, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "57e290376e8c97804a8e4b45d2a92c2c", "sha256": "5cf1522d2abeac45d55f1a13df39ca75d5eb28b15bf639cebfa1fd5c153523d3" }, "downloads": -1, "filename": "ibex-0.1.1.tar.gz", "has_sig": false, "md5_digest": "57e290376e8c97804a8e4b45d2a92c2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14513, "upload_time": "2017-08-10T15:00:25", "url": "https://files.pythonhosted.org/packages/df/7c/ea7bd7d418fbab186ca0eef11bff8113cf412b407152443a2c15489d4e01/ibex-0.1.1.tar.gz" } ], "0.1.1.3": [ { "comment_text": "", "digests": { "md5": "8237ee992fcbb8d004f2d6d2f5292542", "sha256": "5d845218fac96929a9fbdb639521b7deb0f315f917a63dc114fe025699982261" }, "downloads": -1, "filename": "ibex-0.1.1.3.tar.gz", "has_sig": false, "md5_digest": "8237ee992fcbb8d004f2d6d2f5292542", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14522, "upload_time": "2017-08-10T15:09:30", "url": "https://files.pythonhosted.org/packages/33/9c/5f2185742765e6dfb37d9f0ec73c6fe50230cee4159bc1fa7f583cc98b09/ibex-0.1.1.3.tar.gz" } ], "0.1.1.4": [ { "comment_text": "", "digests": { "md5": "9ec562149a95b467aa7abf9eef5f9fde", "sha256": "e703d40a2c85e749e29e9f7c16cc2959aa93ca5d9286db953b3417008d5ef65b" }, "downloads": -1, "filename": "ibex-0.1.1.4-py3.5.egg", "has_sig": false, "md5_digest": "9ec562149a95b467aa7abf9eef5f9fde", "packagetype": "bdist_egg", "python_version": "3.5", "requires_python": null, "size": 48500, "upload_time": "2017-08-11T19:25:07", "url": "https://files.pythonhosted.org/packages/70/e4/1669fb7489cac70370f46d4290c7e9c7f22aa5f04b585c8de366803ec0f5/ibex-0.1.1.4-py3.5.egg" }, { "comment_text": "", "digests": { "md5": "771133891ed0c0a93d73a51e6483c978", "sha256": "cd899185a45d8c4546e56add8457bb26bd23cce2c5cb5fc9b704bb5802aae92c" }, "downloads": -1, "filename": "ibex-0.1.1.4.tar.gz", "has_sig": false, "md5_digest": "771133891ed0c0a93d73a51e6483c978", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15410, "upload_time": "2017-08-11T19:25:09", "url": "https://files.pythonhosted.org/packages/8f/a3/5c87dd9edb2ec8dc7edad6b23c60d8fb02e91dc431a7623e1038837000bb/ibex-0.1.1.4.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "955191a97227fdf813b3ec6315625e3d", "sha256": "5f24dfa5050dfb05407a9aefb48044326e19a9fce0f4b46c795596ef0745a68d" }, "downloads": -1, "filename": "ibex-0.1.2.tar.gz", "has_sig": false, "md5_digest": "955191a97227fdf813b3ec6315625e3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19385, "upload_time": "2017-11-05T14:19:28", "url": "https://files.pythonhosted.org/packages/cf/f3/456e837ee4496c4e7845b9deb8cb8f306610048bc7fb4dabdff5c5c2c519/ibex-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "7d6fe430b0dd5f985d6e4ef23e175786", "sha256": "989db0004432c50e237c34d99912d10c00552e2bb57e162de11799378d9bd40e" }, "downloads": -1, "filename": "ibex-0.1.3.tar.gz", "has_sig": false, "md5_digest": "7d6fe430b0dd5f985d6e4ef23e175786", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24540, "upload_time": "2018-04-21T18:45:08", "url": "https://files.pythonhosted.org/packages/aa/b6/6f018cc4f13b230775a7d1f0028e0132987e7f7743472008d16af75b1843/ibex-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7d6fe430b0dd5f985d6e4ef23e175786", "sha256": "989db0004432c50e237c34d99912d10c00552e2bb57e162de11799378d9bd40e" }, "downloads": -1, "filename": "ibex-0.1.3.tar.gz", "has_sig": false, "md5_digest": "7d6fe430b0dd5f985d6e4ef23e175786", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24540, "upload_time": "2018-04-21T18:45:08", "url": "https://files.pythonhosted.org/packages/aa/b6/6f018cc4f13b230775a7d1f0028e0132987e7f7743472008d16af75b1843/ibex-0.1.3.tar.gz" } ] }