{"id":13487333,"url":"https://github.com/benedekrozemberczki/shapley","last_synced_at":"2025-04-05T14:05:26.091Z","repository":{"id":41810390,"uuid":"237226207","full_name":"benedekrozemberczki/shapley","owner":"benedekrozemberczki","description":"The official implementation of \"The Shapley Value of Classifiers in Ensemble Games\" (CIKM 2021).","archived":false,"fork":false,"pushed_at":"2023-07-01T21:42:58.000Z","size":846,"stargazers_count":219,"open_issues_count":1,"forks_count":35,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T13:11:42.298Z","etag":null,"topics":["classifier","deep-learning","ensemble","ensemble-learning","explainable-ai","explainable-ml","game-theory","game-theory-toolbox","machine-learning","owen","random-forest","random-forest-classifier","shapley","shapley-value","voting-classifier","voting-game","weighted-voting-games"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benedekrozemberczki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-01-30T14:06:40.000Z","updated_at":"2025-03-23T13:31:08.000Z","dependencies_parsed_at":"2023-12-09T10:44:03.201Z","dependency_job_id":null,"html_url":"https://github.com/benedekrozemberczki/shapley","commit_stats":{"total_commits":355,"total_committers":3,"mean_commits":"118.33333333333333","dds":0.05070422535211272,"last_synced_commit":"42b2308cefdb731b624b4a159bf7dc6799c56cd0"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2Fshapley","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2Fshapley/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2Fshapley/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2Fshapley/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benedekrozemberczki","download_url":"https://codeload.github.com/benedekrozemberczki/shapley/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345850,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classifier","deep-learning","ensemble","ensemble-learning","explainable-ai","explainable-ml","game-theory","game-theory-toolbox","machine-learning","owen","random-forest","random-forest-classifier","shapley","shapley-value","voting-classifier","voting-game","weighted-voting-games"],"created_at":"2024-07-31T18:00:57.840Z","updated_at":"2025-04-05T14:05:26.063Z","avatar_url":"https://github.com/benedekrozemberczki.png","language":"Python","funding_links":[],"categories":["The Data Science Toolbox","Model Explanation","Tools","Machine Learning","Python","Python Libraries(sort in alphabeta order)","Technical Resources"],"sub_categories":["Miscellaneous Tools","NLP","Model Pricing","Others","General-Purpose Machine Learning","Evaluation methods","Open Source/Access Responsible AI Software Packages"],"readme":"[pypi-image]: https://badge.fury.io/py/shapley.svg\n[pypi-url]: https://pypi.python.org/pypi/shapley\n[size-image]: https://img.shields.io/github/repo-size/benedekrozemberczki/shapley.svg\n[size-url]: https://github.com/benedekrozemberczki/shapley/archive/master.zip\n[build-image]: https://github.com/benedekrozemberczki/shapley/workflows/CI/badge.svg\n[build-url]: https://github.com/benedekrozemberczki/shapley/actions?query=workflow%3ACI\n[docs-image]: https://readthedocs.org/projects/shapley/badge/?version=latest\n[docs-url]: https://shapley.readthedocs.io/en/latest/?badge=latest\n[coverage-image]: https://codecov.io/gh/benedekrozemberczki/shapley/branch/master/graph/badge.svg\n[coverage-url]: https://codecov.io/github/benedekrozemberczki/shapley?branch=master\n[arxiv-image]: https://img.shields.io/badge/ArXiv-2101.02153-orange.svg\n[arxiv-url]: https://arxiv.org/abs/2101.02153\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"90%\" src=\"https://github.com/benedekrozemberczki/shapley/raw/master/shapley.jpg?sanitize=true\" /\u003e\n\u003c/p\u003e\n\n[![PyPI Version][pypi-image]][pypi-url]\n[![Docs Status][docs-image]][docs-url]\n[![Repo size][size-image]][size-url]\n[![Code Coverage][coverage-image]][coverage-url]\n[![Build Status][build-image]][build-url]\n[![Arxiv][arxiv-image]][arxiv-url]\n\n**[Documentation](https://shapley.readthedocs.io)** | **[External Resources](https://shapley.readthedocs.io/en/latest/notes/resources.html)**\n| **[Research Paper](https://arxiv.org/abs/2101.02153)**\n\n*Shapley* is a Python library for evaluating binary classifiers in a machine learning ensemble.\n\nThe library consists of various methods to compute (approximate) the Shapley value of players (models) in weighted voting games (ensemble games) - a class of transferable utility cooperative games. We covered the exact enumeration based computation and various widely know approximation methods from economics and computer science research papers. There are also functionalities to identify the heterogeneity of the player pool based on the [Shapley entropy](https://arxiv.org/abs/2101.02153). In addition, the framework comes with a [detailed documentation](https://shapley.readthedocs.io/en/latest/), an intuitive [tutorial](https://shapley.readthedocs.io/en/latest/notes/introduction.html), 100% test coverage, and illustrative toy [examples](https://github.com/benedekrozemberczki/shapley/tree/master/examples).\n\n-------------------------------------------------------\n\n**Citing**\n\n\nIf you find *Shapley* useful in your research please consider adding the following citation:\n\n```bibtex\n@inproceedings{rozemberczki2021shapley,\n      title = {{The Shapley Value of Classifiers in Ensemble Games}}, \n      author = {Benedek Rozemberczki and Rik Sarkar},\n      year = {2021},\n      booktitle={Proceedings of the 30th ACM International Conference on Information and Knowledge Management},\n      pages = {1558–1567},\n}\n```\n\n--------------------------------------------------------------\n\n**A simple example**\n\nShapley makes solving voting games quite easy - see the accompanying [tutorial](https://shapley.readthedocs.io/en/latest/notes/introduction.html#applications). For example, this is all it takes to solve a weighted voting game with defined on the fly with permutation sampling:\n\n```python\nimport numpy as np\nfrom shapley import PermutationSampler\n\nW = np.random.uniform(0, 1, (1, 7))\nW = W/W.sum()\nq = 0.5\n\nsolver = PermutationSampler()\nsolver.solve_game(W, q)\nshapley_values = solver.get_solution()\n```\n----------------------------------------------------------------------------------\n\n**Methods Included**\n\nIn detail, the following methods can be used.\n\n\n* **[Expected Marginal Contribution Approximation](https://shapley.readthedocs.io/en/latest/modules/root.html#shapley.solvers.expected_marginal_contributions.ExpectedMarginalContributions)** from Fatima *et al.*: [A Linear Approximation Method for the Shapley Value](https://www.sciencedirect.com/science/article/pii/S0004370208000696)\n\n* **[Multilinear Extension](https://shapley.readthedocs.io/en/latest/modules/root.html#shapley.solvers.multilinear_extension.MultilinearExtension)** from Owen: [Multilinear Extensions of Games](https://www.jstor.org/stable/2661445?seq=1#metadata_info_tab_contents)\n\n* **[Monte Carlo Permutation Sampling](https://shapley.readthedocs.io/en/latest/modules/root.html#shapley.solvers.permutation_sampler.PermutationSampler)** from Maleki *et al.*: [Bounding the Estimation Error of Sampling-based Shapley Value Approximation](https://arxiv.org/abs/1306.4265)\n\n* **[Exact Enumeration](https://shapley.readthedocs.io/en/latest/modules/root.html#shapley.solvers.exact_enumeration.ExactEnumeration)** from Shapley: [A Value for N-Person Games](https://www.rand.org/pubs/papers/P0295.html)\n\n--------------------------------------------------------------------------------\n\n\nHead over to our [documentation](https://shapley.readthedocs.io) to find out more about installation, creation of datasets and a full list of implemented methods and available datasets.\nFor a quick start, check out the [examples](https://github.com/benedekrozemberczki/shapley/tree/master/examples) in the `examples/` directory.\n\nIf you notice anything unexpected, please open an [issue](https://benedekrozemberczki/shapley/issues). If you are missing a specific method, feel free to open a [feature request](https://github.com/benedekrozemberczki/shapley/issues).\n\n--------------------------------------------------------------------------------\n\n**Installation**\n\n```\n$ pip install shapley\n```\n\n**Running tests**\n\n```\n$ python setup.py test\n```\n----------------------------------------------------------------------------------\n\n**Running examples**\n\n```\n$ cd examples\n$ python permutation_sampler_example.py\n```\n\n----------------------------------------------------------------------------------\n\n**License**\n\n- [MIT License](https://github.com/benedekrozemberczki/shapley/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenedekrozemberczki%2Fshapley","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenedekrozemberczki%2Fshapley","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenedekrozemberczki%2Fshapley/lists"}