code: def multiple_evaluations_bandit_algo(
      algo_cls: Type[MABAlgo],
      bandit_cls: Type[MAB],
      n_bandits: int,
      max_steps: int,
      update_every: int = 1,
      freeze_scores_btw_updates: bool = True,
      num_processes: Optional[int] = None,
      algo_kwargs: Optional[Dict] = None,
      bandit_kwargs: Optional[Dict] = None,
  ) -> np.ndarray:
      """
      Perform evaluations on multiple bandit instances and aggregate (average) the result
  
      Args:
          algo_cls: MAB algorithm class to be evaluated
          bandit_cls: Bandit class on which we perform evaluations
          n_bandits: Number of bandit instances among which the results are averaged
          max_steps: Number of time steps to simulate
          update_every: How many steps between the model is updated. 1 is online learning, >1 is iterative batch learning.
          freeze_scores_btw_updates: If True, the scores are frozen between model updates, otherwise at each step we generate
              new scores even if the model wasn't updated. `False` doesn't make sense for UCB models since the scores are deterministic
              and wouldn't change until the model is updated. Use `False` only for models with non-deterministic scores, like Thompson sampling.
          algo_kwargs: A dict of kwargs to pass to algo_cls at initialization
          bandit_kwargs: A dict of kwargs to pass to bandit_cls at initialization
      Returns:
          An array of cumulative pseudo regret (average across multiple bandit instances)
      """
      if algo_kwargs is None:
          algo_kwargs = {}
      if bandit_kwargs is None:
          bandit_kwargs = {}
      pseudo_regrets = []
      arguments = (
          (
              bandit_cls(
                  max_steps=max_steps, **bandit_kwargs
              ),  # pyre-ignore[45]
              algo_cls(**algo_kwargs),  # pyre-ignore[45]
          )
          for _ in range(n_bandits)
      )
      with Pool(num_processes) as pool:
          pseudo_regrets = pool.starmap(
              partial(
                  single_evaluation_bandit_algo,
                  update_every=update_every,
                  freeze_scores_btw_updates=freeze_scores_btw_updates,
              ),
              arguments,
          )
      return np.stack(pseudo_regrets).mean(0)
  
imports: from abc import ABC, abstractmethod
  from functools import partial
  from multiprocessing import Pool
  from typing import Dict, List, Optional, Tuple, Type, Union
  import numpy
  import torch
  from reagent.mab.mab_algorithm import MABAlgo
  from torch import Tensor
label_desc: Use image node_id 2 for calling a global function with example usage: multiple_evaluations_bandit_algo(algo_cls, bandit_cls, n_bandits, max_steps, update_every, freeze_scores_btw_updates, num_processes, algo_kwargs, bandit_kwargs) and returns: np