Some measure useful for cooperative games. In this first version it contains:
The easy way to use this functions are:
- Shapley value
from cooperativegames import shapley_value
entities = np.array(range(3))
funct = lambda x: 1 if list(x) in [[0, 2], [1, 2], [0, 1, 2]] else 0
sh_v1 = shapley_value(entities, funct)
- Shapley-Shubik power index
from cooperativegames import shapley_index
distrib_repr = np.array([3, 2, 1, 1])
win_thr = 0.5
sh_sh_ind = shapley_index(distrib_repr, win_thr)
- Banzhaf power index
from cooperativegames import banzhaf_index
distrib_repr = np.array([4, 3, 2, 1])
win_thr = 0.5
bzf_ind = banzhaf_index(distrib_repr, win_thr)
It is provide a testing module called test.py. It runs only with the importation.
import cooperativegames
CooperativeGames.test()
or it could be done also with nosetests of nose,
nosetests
- plots and visualizations
- simulations
- obtain data