Counterfactual Regret Minimization¶
The implementation of Counterfactual regret minimization (CFR) algorithm. (Zinkevich et al. “Regret minimization in games with incomplete information” 2008)
CFR is a self-play algorithm that assumes that the joint strategy of all players in the game is public knowledge. The algorithm iteratively updates the regret of each player’s action at each information set. The average strategy of each player in CFR provably converges to a Nash equilibrium.
Counterfactual regrets are calculated by searching down the game tree, taking into account the reach probabilities.
Reach probabilities are factored in since the nodes in one’s player infostate might belong to different infostates of their opponent. Therefore, not every node (history) in the infostate is equally likely to be reached, so the reach probs should be taken into account to skew the action distribution at that infostate appropriately.
The cfr formulation looks similar to the advantage function in RL Q-learning.
- class imperfecto.algos.cfr.CounterFactualRegretMinimizerPlayer(name, player_id)[source]¶
Bases:
imperfecto.algos.player.Player
CounterFactualRegretMinimizerPlayer.
- strategy_sum¶
map from infostate to the cumulative strategy at that infostate until now. Useful for calculating the average strategy over many iters.
- Type
- class imperfecto.algos.cfr.counterfactualRegretMinimizerTrainer(Game, players, n_iters=100)[source]¶
Bases:
object
CFR with chance-sampling.
CFR (Zinkevich et al. “Regret minimization in games with incomplete information” 2008) is a self-play algorithm that assumes that the joint strategy of all players in the game is public knowledge. The algorithm iteratively updates the regret of each player’s action at each information set. The average strategy of each player in CFR provably converges to a Nash equilibrium.
- Parameters
Game (Type[ExtensiveFormGame]) – the game class to be trained.
players (
Sequence
[CounterFactualRegretMinimizerPlayer
]) – the players in the game, each of typeCounterFactualRegretMinimizerPlayer
.n_iters (
int
) – number of iterations to run the algorithm.
- game¶
the game to train on.
- Type
- cfr(history, reach_probs)[source]¶
Counterfactual regret minimization update step at the current node.
- CFR is quite similar to advantage function in classic Q-learning. For example,
node_utils ~ V(s)
counterfactual_values ~ Q(s, a)
regret ~ advantage function: Q(s, a) - V(s)
- Parameters
- Return type
- Returns
the utility (expected payoff) of the current node for each player.