{ "info": { "author": "Julius Adebayo", "author_email": "julius.adebayo@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "FairML: Auditing Black-Box Predictive Models\n============================================\n\nFairML is a python toolbox auditing the machine learning models for\nbias.\n\n|Build Status| |Coverage Status| |GitHub license| |GitHub issues|\n\n.. figure:: fairml/master/doc/images/logo2-small.png\n :alt: Logo\n\n Logo\n\nDescription\n~~~~~~~~~~~\n\nPredictive models are increasingly been deployed for the purpose of\ndetermining access to services such as credit, insurance, and\nemployment. Despite societal gains in efficiency and productivity\nthrough deployment of these models, potential systemic flaws have not\nbeen fully addressed, particularly the potential for unintentional\ndiscrimination. This discrimination could be on the basis of race,\ngender, religion, sexual orientation, or other characteristics. This\nproject addresses the question: how can an analyst determine the\nrelative significance of the inputs to a black-box predictive model in\norder to assess the model\u2019s fairness (or discriminatory extent)?\n\nWe present FairML, an end-to-end toolbox for auditing predictive models\nby quantifying the relative significance of the model\u2019s inputs. FairML\nleverages model compression and four input ranking algorithms to\nquantify a model\u2019s relative predictive dependence on its inputs. The\nrelative significance of the inputs to a predictive model can then be\nused to assess the fairness (or discriminatory extent) of such a model.\nWith FairML, analysts can more easily audit cumbersome predictive models\nthat are difficult to interpret.s of black-box algorithms and\ncorresponding input data.\n\nInstallation\n~~~~~~~~~~~~\n\nYou can pip install this package, via github - i.e. this repo - using\nthe following commands:\n\npip install https://github.com/adebayoj/fairml/archive/master.zip\n\nor you can clone the repository doing:\n\ngit clone https://github.com/adebayoj/fairml.git\n\nsudo python setup.py install\n\nMethodology\n~~~~~~~~~~~\n\n.. figure:: fairml/doc/images/fairml_methodology_picture.png\n :alt: Methodology\n\n Methodology\n\nCode Demo\n~~~~~~~~~\n\nNow we show how to use the fairml python package to audit a black-box\nmodel.\n\n.. code:: python\n\n # First we import modules for model building and data processing.\n\n import pandas as pd\n import numpy as np\n from sklearn.linear_model import LogisticRegression\n\n \"\"\"\n Now, we import the two key methods from fairml.\n audit_model takes:\n\n - (required) black-box function, which is the model to be audited\n - (required) sample_data to be perturbed for querying the function. This has to be a pandas dataframe with no missing data.\n\n - other optional parameters that control the mechanics of the auditing process, for example:\n - number_of_runs : number of iterations to perform\n - interactions : flag to enable checking model dependence on interactions.\n\n audit_model returns an overloaded dictionary where keys are the column names of input pandas dataframe and values are\n lists containing model dependence on that particular feature. These lists of size number_of_runs.\n\n \"\"\"\n from fairml import audit_model\n from fairml import plot_generic_dependence_dictionary\n\nAbove, we provide a quick explanation of the key fairml functionality.\nNow we move into building an example model that we'd like to audit.\n\n.. code:: python\n\n # read in the propublica data to be used for our analysis.\n propublica_data = pd.read_csv(\n filepath_or_buffer=\"./doc/example_notebooks/\"\n \"propublica_data_for_fairml.csv\")\n\n # create feature and design matrix for model building.\n compas_rating = propublica_data.score_factor.values\n propublica_data = propublica_data.drop(\"score_factor\", 1)\n\n\n # this is just for demonstration, any classifier or regressor\n # can be used here. fairml only requires a predict function\n # to diagnose a black-box model.\n\n # we fit a quick and dirty logistic regression sklearn\n # model here.\n clf = LogisticRegression(penalty='l2', C=0.01)\n clf.fit(propublica_data.values, compas_rating)\n\nNow let's audit the model built with FairML.\n\n.. code:: python\n\n\n # call audit model with model\n total, _ = audit_model(clf.predict, propublica_data)\n\n # print feature importance\n print(total)\n\n # generate feature dependence plot\n fig = plot_dependencies(\n total.get_compress_dictionary_into_key_median(),\n reverse_values=False,\n title=\"FairML feature dependence\"\n )\n plt.savefig(\"fairml_ldp.eps\", transparent=False, bbox_inches='tight')\n\nThe demo above produces the figure below.\n\n.. figure:: fairml/master/doc/images/feature_dependence_plot_fairml_propublica_linear_direct_small.png\n :alt: Example Output\n\n Example Output\n\n| Feel free to email the authors with any questions:\n| `Julius Adebayo GitHub `__\n julius.adebayo@gmail.com\n\nData\n~~~~\n\nThe data used for the demo above is available in the repo at:\n/doc/example\\_notebooks/propublica\\_data\\_for\\_fairml.csv\n\n.. |Build Status| image:: https://travis-ci.org/adebayoj/fairml.svg?branch=master\n :target: https://travis-ci.org/adebayoj/fairml/\n.. |Coverage Status| image:: https://coveralls.io/repos/github/adebayoj/fairml/badge.svg?branch=master\n :target: https://coveralls.io/github/adebayoj/fairml?branch=master\n.. |GitHub license| image:: https://img.shields.io/badge/license-MIT-blue.svg\n :target: https://raw.githubusercontent.com/adebayoj/fairml/master/LICENSE\n.. |GitHub issues| image:: https://img.shields.io/github/issues/adebayoj/fairml.svg\n :target: https://github.com/adebayoj/fairml/issues", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/adebayoj/fairml", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "fairml", "package_url": "https://pypi.org/project/fairml/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/fairml/", "project_urls": { "Homepage": "https://github.com/adebayoj/fairml" }, "release_url": "https://pypi.org/project/fairml/0.1.1.5rc8/", "requires_dist": null, "requires_python": "", "summary": "Module for measuring feature dependence for black-box models", "version": "0.1.1.5rc8" }, "last_serial": 2985361, "releases": { "0.1.1.5rc1": [ { "comment_text": "", "digests": { "md5": "5ab03fcbc3dded8f9e58b121f9fbcf42", "sha256": "3ad8126ba9e7121d6ff8ff2a84dcff3d71884c6b6d3c79bdb9471c65f9344974" }, "downloads": -1, "filename": "fairml-0.1.1.5rc1.tar.gz", "has_sig": false, "md5_digest": "5ab03fcbc3dded8f9e58b121f9fbcf42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8782, "upload_time": "2017-06-28T15:16:41", "url": "https://files.pythonhosted.org/packages/06/6e/d896aa24907e304c6edab415d023282bf18205d4b2ea3f41fb16d3d31834/fairml-0.1.1.5rc1.tar.gz" } ], "0.1.1.5rc2": [ { "comment_text": "", "digests": { "md5": "e4b232795d31afbd8f2cc2f8e3968456", "sha256": "8c00519deb3a57d8a73f3bc14f52e62df076c604e1940f5ddee32390ee2d70d3" }, "downloads": -1, "filename": "fairml-0.1.1.5rc2.tar.gz", "has_sig": false, "md5_digest": "e4b232795d31afbd8f2cc2f8e3968456", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9723, "upload_time": "2017-06-28T15:27:21", "url": "https://files.pythonhosted.org/packages/c8/57/101aa038e4242441416f6e371ecc29ada483607f42da4981073f77fd3cdc/fairml-0.1.1.5rc2.tar.gz" } ], "0.1.1.5rc3": [ { "comment_text": "", "digests": { "md5": "16412fca77fc46114736b5c9131df6fd", "sha256": "5cacf0218e99806e510d0def78d50a6fab9a6e40dd1fc0847f07e8ac77aac801" }, "downloads": -1, "filename": "fairml-0.1.1.5rc3.tar.gz", "has_sig": false, "md5_digest": "16412fca77fc46114736b5c9131df6fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10187, "upload_time": "2017-06-28T15:46:09", "url": "https://files.pythonhosted.org/packages/c0/35/d03692cd15a35039919b01ef39fef3d91190f1ea113a28b60f7ed15f9136/fairml-0.1.1.5rc3.tar.gz" } ], "0.1.1.5rc4": [ { "comment_text": "", "digests": { "md5": "224e81bc60f8107638179bfc1022ceea", "sha256": "1b9c9cff6b49f318c5070fc09ae9c3431a9e7af375e9e4354aa11d5d13b72677" }, "downloads": -1, "filename": "fairml-0.1.1.5rc4.tar.gz", "has_sig": false, "md5_digest": "224e81bc60f8107638179bfc1022ceea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9774, "upload_time": "2017-06-28T15:54:16", "url": "https://files.pythonhosted.org/packages/f4/5b/e634409081d9c5908d3710244fea0552ea040c44fe26c09c532b02e444a5/fairml-0.1.1.5rc4.tar.gz" } ], "0.1.1.5rc5": [ { "comment_text": "", "digests": { "md5": "81a4e163f8dce7c665a67c6ebf15b588", "sha256": "23266ddf5bfb829762045e928c03aeb9c03feb916f3c23395300fa935568542f" }, "downloads": -1, "filename": "fairml-0.1.1.5rc5.tar.gz", "has_sig": false, "md5_digest": "81a4e163f8dce7c665a67c6ebf15b588", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9778, "upload_time": "2017-06-28T16:01:27", "url": "https://files.pythonhosted.org/packages/a7/e5/31bcd49c40121e12d5aa12707da59535a81e72ef0e7cb871fc188e7c1283/fairml-0.1.1.5rc5.tar.gz" } ], "0.1.1.5rc6": [ { "comment_text": "", "digests": { "md5": "f54db4dd521fa8679e3bb4b20e99d721", "sha256": "a87c83aeeddc40f64d8f0e7866ff8f901507b76023ec69f3bb11b58f32b151c5" }, "downloads": -1, "filename": "fairml-0.1.1.5rc6.tar.gz", "has_sig": false, "md5_digest": "f54db4dd521fa8679e3bb4b20e99d721", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9796, "upload_time": "2017-06-28T16:03:36", "url": "https://files.pythonhosted.org/packages/47/a4/a3e6bd6d413134dd8f96ac68a0e8f3c97bb88d933bf0fa5abdba7061a17c/fairml-0.1.1.5rc6.tar.gz" } ], "0.1.1.5rc7": [ { "comment_text": "", "digests": { "md5": "c305d1f7a92cb6074f9830230b3f9306", "sha256": "0d292efd3d3ae2da1c19aaac5acc43db95f5368e5d26ed2d1a6228f319c35ac9" }, "downloads": -1, "filename": "fairml-0.1.1.5rc7.tar.gz", "has_sig": false, "md5_digest": "c305d1f7a92cb6074f9830230b3f9306", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9782, "upload_time": "2017-06-28T16:06:56", "url": "https://files.pythonhosted.org/packages/83/3b/5f4470d64025962bf5ebc3865a4599baeaaf3ef2452d4578ece419d6bf16/fairml-0.1.1.5rc7.tar.gz" } ], "0.1.1.5rc8": [ { "comment_text": "", "digests": { "md5": "8e5022cc6c643be484d25381d15c20ff", "sha256": "5e55a49df4d298b641d0d71618dbc5293b46d13aeeca9828d4d52611c19ac367" }, "downloads": -1, "filename": "fairml-0.1.1.5rc8.tar.gz", "has_sig": false, "md5_digest": "8e5022cc6c643be484d25381d15c20ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9789, "upload_time": "2017-06-28T16:17:13", "url": "https://files.pythonhosted.org/packages/92/c7/99bd6a7e9398913a3b12acabc450b0890408d8f363600e59c0b952f94769/fairml-0.1.1.5rc8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8e5022cc6c643be484d25381d15c20ff", "sha256": "5e55a49df4d298b641d0d71618dbc5293b46d13aeeca9828d4d52611c19ac367" }, "downloads": -1, "filename": "fairml-0.1.1.5rc8.tar.gz", "has_sig": false, "md5_digest": "8e5022cc6c643be484d25381d15c20ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9789, "upload_time": "2017-06-28T16:17:13", "url": "https://files.pythonhosted.org/packages/92/c7/99bd6a7e9398913a3b12acabc450b0890408d8f363600e59c0b952f94769/fairml-0.1.1.5rc8.tar.gz" } ] }