code: def test_compare_bandit_algos(self):
      max_steps = 1000
      algo_clss = [UCB1, MetricUCB, BernoulliBetaThompson]
      algo_names, regret_trajectories = compare_bandit_algos(
          algo_clss=algo_clss,
          bandit_cls=BernoilliMAB,
          n_bandits=5,
          max_steps=max_steps,
          algo_kwargs=[
              {"n_arms": 2, "estimate_variance": False},
              {"n_arms": 2},
              {"n_arms": 2},
          ],
          bandit_kwargs={"probs": torch.Tensor([0.1, 0.2])},
      )
  
      self.assertEqual(len(algo_names), len(algo_clss))
      self.assertEqual(len(regret_trajectories), len(algo_clss))
  
      self.assertListEqual(
          algo_names, ["UCB1", "MetricUCB", "BernoulliBetaThompson"]
      )
  
      for traj in regret_trajectories:
          self.assertIsInstance(traj, np.ndarray)
          self.assertEqual(traj.shape, (max_steps,))
  
          # make sure regret is non-decreasing
          self.assertGreaterEqual(np.diff(traj, prepend=0).min(), 0)
  
      # UCB1 should be much worse than MetricUCB in this setting because UCB1 assumes
      #   variance is equal to 1, while MetricUCB estimates it
      self.assertGreater(
          regret_trajectories[0][-1], regret_trajectories[1][-1]
      )
  
imports: import unittest
  from io import BytesIO
  from itertools import cycle
  from unittest import mock
  import numpy
  import numpy.testing
  import torch
  from parameterized.parameterized import parameterized
  from pytorch_lightning import seed_everything
  from reagent.mab.mab_algorithm import get_arm_indices, place_values_at_indices, randomized_argmax, reindex_multiple_tensors
  from reagent.mab.simulation import BernoilliMAB, compare_bandit_algos, multiple_evaluations_bandit_algo, single_evaluation_bandit_algo
  from reagent.mab.thompson_sampling import BaseThompsonSampling, BernoulliBetaThompson, NormalGammaThompson
  from reagent.mab.ucb import BaseUCB, MetricUCB, UCB1, UCBTuned
label_desc: Use image node_id 5 for calling the TestSimulation obj's underlying member method code with example usage: obj.test_compare_bandit_algos() without return types