nash.learning package

Submodules

nashpy.learning.fictitious_play module

Code to carry out fictitious learning

nashpy.learning.fictitious_play.fictitious_play(A, B, iterations, play_counts=None)[source]

Implement fictitious play

Parameters
  • A (array) – The row player payoff matrix.

  • B (array) – The column player payoff matrix.

  • iterations (int) – The number of iterations of the algorithm.

  • play_counts (array) – The play counts.

Yields

array – The play counts.

nashpy.learning.fictitious_play.get_best_response_to_play_count(A, play_count)[source]

Returns the best response to a belief based on the playing distribution of the opponent

Parameters
  • A (array) – The utility matrix.

  • play_count (array) – The play counts.

Returns

The action that corresponds to the best response.

Return type

int

nashpy.learning.fictitious_play.update_play_count(play_count, play)[source]

Update a belief vector with a given play

Parameters
  • play_count (array) – The play counts.

  • play (int) – The given play.

Returns

The updated play counts.

Return type

array