shapley_numba
Numba-based computations for cooperative games.
shapley_numba is a high-performance Python library for computing Shapley values and Harsanyi dividends in cooperative game theory. It leverages Numba’s JIT compilation to achieve fast computations even for games with many players.
Features
Fast exact Shapley calculation - Optimized implementations using Numba
Shapley Monte Carlo approximation - For large-scale games
Harsanyi Dividends (synergies) computation - Analyze player interactions
Set iteration tools - Efficient subset enumeration utilities
Installation
Using pip:
pip install shapley-numba
Using uv:
uv add shapley-numba
Quick Example
from shapley_numba.shapley import shapley
from shapley_numba.examples import GloveGame
glove_game = GloveGame(num_left_gloves=1)
shapley(glove_game, num_players=3)
See shapley_numba.shapley.shapley() and shapley_numba.examples.GloveGame for more details.
Documentation Contents
Getting Started
Concepts
Notebooks