Published:

Build Status Coverage Status

Some measure useful for cooperative games. In this first version it contains:

Tutorial

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)

Testing the module

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

TODO

  • plots and visualizations
  • simulations
  • obtain data

Leave a Comment