class_docstr: A class that simulates a bandit
  
  Args:
      probs: A tensor of per-arm success probabilities
      max_steps: Max number os steps to simulate. This has to be specified because we pre-generate
          all the rewards at initialization (for speedup - generating random matrix once should be
          faster than generating random scalars in a loop)
class_docstr_tok: ["A","class","that","simulates","a","bandit","Args",":","probs",":","A","tensor","of","per-arm","success","probabilities","max_steps",":","Max","number","os","steps","to","simulate",".","This","has","to","be","specified","because","we","pre-generate","all","the","rewards","at","initialization","(","for","speedup","-","generating","random","matrix","once","should","be","faster","than","generating","random","scalars","in","a","loop",")"]
docstr: Sample a reward from a specific arm
  
  Args:
      arm_idx: Index of arm from which reward is sampled
  Returns:
      Sampled reward
docstr_tok: ["Sample","a","reward","from","a","specific","arm","Args",":","arm_idx",":","Index","of","arm","from","which","reward","is","sampled","Returns",":","Sampled","reward"]
code: def act(self, arm_id: str) -> float:
      """
      Sample a reward from a specific arm
  
      Args:
          arm_idx: Index of arm from which reward is sampled
      Returns:
          Sampled reward
      """
      arm_idx = self.arm_ids.index(arm_id)
      assert arm_idx <= (len(self.expected_rewards) - 1)
      assert self.t < self.max_steps
      val = self.rewards[self.t, arm_idx].item()
      self.t += 1
      return val
  
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 the BernoilliMAB obj's underlying member method code with example usage: obj.act(arm_id) and returns: val