Name | shapley-value JSON |
Version |
0.0.3
JSON |
| download |
home_page | None |
Summary | Shapley Value Calculator |
upload_time | 2024-09-30 20:03:30 |
maintainer | None |
docs_url | None |
author | Your Name |
requires_python | None |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
## Shapley Value Calculator
### Overview
This Python package calculates Shapley values for cooperative game theory. Shapley values provide a fair way to distribute the total payoff among players in a cooperative game, based on their individual contributions.
### Installation
Using pip:
```bash
pip install shapley-value
```
### Usage
#### Basic Example
```python
from shapley_value import ShapleyCombinations
players = ['A', 'B', 'C']
coalition_values = {
('A',): 10,
('B',): 20,
('C',): 30,
('A', 'B'): 50,
('A', 'C'): 60,
('B', 'C'): 70,
('A', 'B', 'C'): 100
}
shapley_combinations = ShapleyCombinations(players)
shapley_values = shapley_combinations.calculate_shapley_values(coalition_values)
print(shapley_values)
```
```python
from shapley_value import ShapleyValueCalculator
# Example usage
def evaluation_function(coalition):
# Example evaluation function: sum of player values
return sum(value for value in coalition)
players = [10, 20, 30]
calculator = ShapleyValueCalculator(evaluation_function, players, num_jobs=-1)
shapley_values = calculator.calculate_shapley_values()
print(shapley_values)
raw_data = calculator.get_raw_data()
print(raw_data)
calculator.save_raw_data('sample_shapley_raw_data.csv')
```
### Features
- Calculates Shapley values for cooperative games
- Supports any number of players
- Handles coalition values as a dictionary
- Includes example usage
### Requirements
- Python 3.x
- `itertools` module
### License
MIT License
### Contributing
1. Fork the repository.
2. Make your changes.
3. Commit your changes.
4. Open a pull request.
### Authors
- newbie
### Version History
- 0.0.2: Initial release
Raw data
{
"_id": null,
"home_page": null,
"name": "shapley-value",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Your Name",
"author_email": "your@email.com",
"download_url": "https://files.pythonhosted.org/packages/f7/c3/7aebf7383e9cdb69f83bd0fbf114054131491d7e0b0f1675d27b5ddf0cf4/shapley-value-0.0.3.tar.gz",
"platform": null,
"description": "## Shapley Value Calculator\n\n### Overview\n\nThis Python package calculates Shapley values for cooperative game theory. Shapley values provide a fair way to distribute the total payoff among players in a cooperative game, based on their individual contributions.\n\n### Installation\n\nUsing pip:\n\n```bash\npip install shapley-value\n```\n\n### Usage\n\n#### Basic Example\n\n```python\nfrom shapley_value import ShapleyCombinations\n\nplayers = ['A', 'B', 'C']\ncoalition_values = {\n ('A',): 10,\n ('B',): 20,\n ('C',): 30,\n ('A', 'B'): 50,\n ('A', 'C'): 60,\n ('B', 'C'): 70,\n ('A', 'B', 'C'): 100\n}\n\nshapley_combinations = ShapleyCombinations(players)\nshapley_values = shapley_combinations.calculate_shapley_values(coalition_values)\nprint(shapley_values)\n```\n\n```python\nfrom shapley_value import ShapleyValueCalculator\n # Example usage\n def evaluation_function(coalition):\n # Example evaluation function: sum of player values\n return sum(value for value in coalition)\n\n players = [10, 20, 30]\n calculator = ShapleyValueCalculator(evaluation_function, players, num_jobs=-1)\n shapley_values = calculator.calculate_shapley_values()\n print(shapley_values)\n\n raw_data = calculator.get_raw_data()\n print(raw_data)\n\n calculator.save_raw_data('sample_shapley_raw_data.csv')\n```\n\n### Features\n\n- Calculates Shapley values for cooperative games\n- Supports any number of players\n- Handles coalition values as a dictionary\n- Includes example usage\n\n### Requirements\n\n- Python 3.x\n- `itertools` module\n\n### License\n\nMIT License\n\n### Contributing\n\n1. Fork the repository.\n2. Make your changes.\n3. Commit your changes.\n4. Open a pull request.\n\n### Authors\n\n- newbie\n\n\n### Version History\n\n- 0.0.2: Initial release\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Shapley Value Calculator",
"version": "0.0.3",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ecf79158bd95b78dcf005037f1b29583b8abf9700c0140c610cd4a87c0831fee",
"md5": "cdc9eeaa94b8bc7b7fc0b83bcbc5ae4f",
"sha256": "93a43af7bbbf5012cfeb71edee4415e84d308d3a2abd22b065f8adf2b05aecf7"
},
"downloads": -1,
"filename": "shapley_value-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cdc9eeaa94b8bc7b7fc0b83bcbc5ae4f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5416,
"upload_time": "2024-09-30T20:03:28",
"upload_time_iso_8601": "2024-09-30T20:03:28.749013Z",
"url": "https://files.pythonhosted.org/packages/ec/f7/9158bd95b78dcf005037f1b29583b8abf9700c0140c610cd4a87c0831fee/shapley_value-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f7c37aebf7383e9cdb69f83bd0fbf114054131491d7e0b0f1675d27b5ddf0cf4",
"md5": "c1d85269d219c3cab65a6122dfc7e063",
"sha256": "d0dc1ec7a24ea2e431526065f07ddf4dba10f8d76e36010aa6569c53816a1b3a"
},
"downloads": -1,
"filename": "shapley-value-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "c1d85269d219c3cab65a6122dfc7e063",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4559,
"upload_time": "2024-09-30T20:03:30",
"upload_time_iso_8601": "2024-09-30T20:03:30.098581Z",
"url": "https://files.pythonhosted.org/packages/f7/c3/7aebf7383e9cdb69f83bd0fbf114054131491d7e0b0f1675d27b5ddf0cf4/shapley-value-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-30 20:03:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "shapley-value"
}