class_docstr: <a id="InfoSet"></a>
  
  ## Information Set $I_i$
class_docstr_tok: ["<","a","id=","''","InfoSet","''",">","<","\/a",">","#","#","Information","Set","$","I_i","$"]
docstr: ## Get average strategy
  
  $$      extcolor{cyan}{ar{\sigma}^T_i(I)(a)} =
   rac{\sum_{t=1}^T \pi_i^{\sigma^t}(I)  extcolor{lightgreen}{\sigma^t(I)(a)}}
   {\sum_{t=1}^T \pi_i^{\sigma^t}(I)}$$
docstr_tok: ["#","#","Get","average","strategy","$","$","extcolor","{","cyan","}","{","\bar","{","\\sigma","}","^T_i","(","I",")","(","a",")","}","=","rac","{","\\sum_","{","t=1","}","^T","\\pi_i^","{","\\sigma^t","}","(","I",")","extcolor","{","lightgreen","}","{","\\sigma^t","(","I",")","(","a",")","}","}","{","\\sum_","{","t=1","}","^T","\\pi_i^","{","\\sigma^t","}","(","I",")","}","$","$"]
code: def get_average_strategy(self):
      """
      ## Get average strategy
  
      $$\textcolor{cyan}{\bar{\sigma}^T_i(I)(a)} =
       \frac{\sum_{t=1}^T \pi_i^{\sigma^t}(I)\textcolor{lightgreen}{\sigma^t(I)(a)}}
       {\sum_{t=1}^T \pi_i^{\sigma^t}(I)}$$
      """
      # $$\sum_{t=1}^T \pi_i^{\sigma^t}(I) \textcolor{lightgreen}{\sigma^t(I)(a)}$$
      cum_strategy = {
          a: self.cumulative_strategy.get(a, 0.0)
          for a in self.actions()
      }
      # $$\sum_{t=1}^T \pi_i^{\sigma^t}(I) =
      # \sum_{a \in A(I)} \sum_{t=1}^T
      # \pi_i^{\sigma^t}(I)\textcolor{lightgreen}{\sigma^t(I)(a)}$$
      strategy_sum = sum(cum_strategy.values())
      # If $\sum_{t=1}^T \pi_i^{\sigma^t}(I) > 0$,
      if strategy_sum > 0:
          # $$\textcolor{cyan}{\bar{\sigma}^T_i(I)(a)} =
          #  \frac{\sum_{t=1}^T \pi_i^{\sigma^t}(I)\textcolor{lightgreen}{\sigma^t(I)(a)}}
          #  {\sum_{t=1}^T \pi_i^{\sigma^t}(I)}$$
          return {a: s / strategy_sum for a, s in cum_strategy.items()}
      # Otherwise,
      else:
          # $\lvert A(I) \rvert$
          count = len(list(a for a in cum_strategy))
          # $$\textcolor{cyan}{\bar{\sigma}^T_i(I)(a)} =
          # \frac{1}{\lvert A(I) \rvert}$$
          return {a: 1 / count for a, r in cum_strategy.items()}
  
imports: from typing import NewType, Dict, List, Callable, cast
  from labml import monit, tracker, logger, experiment
  from labml.configs import BaseConfigs, option
label_desc: Use image node_id 7 for calling the InfoSet obj's underlying member method code with example usage: obj.get_average_strategy() and returns: unknown, unknown