gameanalysis.paygame module

Module for games with potentially sparse payoff data

gameanalysis.paygame.game(num_role_players, num_role_strats, profiles, payoffs)[source]

Create a game with default names

Parameters
  • num_role_players (ndarray-like, int,) – The number of players per role.

  • num_role_strats (ndarray-like, int,) – The number of strategies per role.

  • profiles (ndarray-like, int) – The profiles for the game, with shape (num_profiles, num_strats).

  • payoffs (ndarray-like, float) – The payoffs for the game, with shape (num_profiles, num_strats).

gameanalysis.paygame.game_copy(copy_game)[source]

Copy structure and payoffs from an existing game

Parameters

copy_game (RsGame) – Game to copy data from. This will create a copy with the games profiles and payoffs.

gameanalysis.paygame.game_json(json)[source]

Read a Game from json

This takes a game in any valid payoff format (i.e. output by this or by EGTA Online), and converts it into a Game. If several payoff exist, the mean is taken. This means that loading a game using this method, and loading it as a sample game produce different results, as the sample game will truncate extra payoffs for an individual profile, while this will take the minimum. Note, that there is no legitimate way to get a game with that structure, but it is possible to write the json.

gameanalysis.paygame.game_names(role_names, num_role_players, strat_names, profiles, payoffs)[source]

Create a game with specified names

Parameters
  • role_names ([str]) – The name for each role.

  • num_role_players (ndarray-like, int,) – The number of players per role.

  • strat_names ([[str]]) – The name for each strategy per role.

  • profiles (ndarray-like, int) – The profiles for the game, with shape (num_profiles, num_strats).

  • payoffs (ndarray-like, float) – The payoffs for the game, with shape (num_profiles, num_strats).

gameanalysis.paygame.game_replace(copy_game, profiles, payoffs)[source]

Copy structure from an existing game with new data

Parameters
  • copy_game (Game) – Game to copy structure out of. Structure includes role names, strategy names, and the number of players.

  • profiles (ndarray-like, int) – The profiles for the game, with shape (num_profiles, num_strats).

  • payoffs (ndarray-like, float) – The payoffs for the game, with shape (num_profiles, num_strats).

gameanalysis.paygame.samplegame(num_role_players, num_role_strats, profiles, sample_payoffs)[source]

Create a SampleGame with default names

Parameters
  • num_role_players (ndarray-like, int) – The number of players per role.

  • num_role_strats (ndarray-like, int) – The number of strategies per role.

  • profiles (ndarray-like, int) – The profiles for the game, with shape (num_profiles, num_strats).

  • sample_payoffs ([ndarray-like, float]) – The sample payoffs for the game.

gameanalysis.paygame.samplegame_copy(copy_game)[source]

Copy a SampleGame from another game

If game defined sample_payoffs, this will be created with those, otherwise it will create a game with one sample per payoff.

Parameters

copy_game (RsGame) – Game to copy data from.

gameanalysis.paygame.samplegame_flat(num_role_players, num_role_strats, profiles, payoffs)[source]

Create a SampleGame with default names and flat profiles

Parameters
  • num_role_players (ndarray-like, int) – The number of players per role.

  • num_role_strats (ndarray-like, int) – The number of strategies per role.

  • profiles (ndarray-like, int) – The profiles for the game, potentially with duplicates, with shape (num_sample_profiles, num_strats).

  • payoffs (ndarray-like, float) – The sample payoffs for the game, in parallel with the profiles they’re samples from, with shape (num_sample_profiles, num_strats).

gameanalysis.paygame.samplegame_json(json)[source]

Read a SampleGame from json

This will read any valid payoff game as a sample game. Invalid games will produce an empty sample game.

gameanalysis.paygame.samplegame_names(role_names, num_role_players, strat_names, profiles, sample_payoffs)[source]

Create a SampleGame with specified names

Parameters
  • role_names ([str]) – The name of each role.

  • num_role_players (ndarray) – The number of players for each role.

  • strat_names ([[str]]) – The name of each strategy.

  • profiles (ndarray) – The profiles for the game.

  • sample_payoffs ([ndarray]) – The sample payoffs for the game.

gameanalysis.paygame.samplegame_names_flat(role_names, num_role_players, strat_names, profiles, payoffs)[source]

Create a SampleGame with specified names and flat payoffs

Parameters
  • role_names ([str]) – The name of each role.

  • num_role_players (ndarray) – The number of players for each role.

  • strat_names ([[str]]) – The name of each strategy.

  • profiles (ndarray-like, int) – The profiles for the game, potentially with duplicates, (num_sample_profiles, num_strats).

  • payoffs (ndarray-like, float) – The sample payoffs for the game, in parallel with the profiles they’re samples from, (num_sample_profiles, num_strats).

gameanalysis.paygame.samplegame_replace(copy_game, profiles, sample_payoffs)[source]

Replace sample payoff data for an existing game

Parameters
  • copy_game (BaseGame, optional) – Game to copy information out of.

  • profiles (ndarray-like, int) – The profiles for the game, with shape (num_profiles, num_strats).

  • sample_payoffs ([ndarray-like, float]) – The sample payoffs for the game.

gameanalysis.paygame.samplegame_replace_flat(copy_game, profiles, payoffs)[source]

Replace sample payoff data for an existing game

Parameters
  • copy_game (BaseGame, optional) – Game to copy information out of.

  • profiles (ndarray-like, int) – The profiles for the game, potentially with duplicates, with shape (num_sample_profiles, num_strats).

  • payoffs (ndarray-like, float) – The sample payoffs for the game, in parallel with the profiles they’re samples from, with shape (num_sample_profiles, num_strats).