class_docstr: Base class for UCB-like Multi-Armed Bandits (MAB)
  
  Args:
      estimate_variance: If True, per-arm reward variance is estimated and we multiply thconfidence interval width
          by its square root
      min_variance: The lower bound applied to the estimated variance. If variance is not estimated, this value is used instead of an estimate.
      alpha: Scalar multiplier for confidence interval width. Values above 1.0 make exploration more aggressive, below 1.0 less aggressive
class_docstr_tok: ["Base","class","for","UCB-like","Multi-Armed","Bandits","(","MAB",")","Args",":","estimate_variance",":","If","True",",","per-arm","reward","variance","is","estimated","and","we","multiply","thconfidence","interval","width","by","its","square","root","min_variance",":","The","lower","bound","applied","to","the","estimated","variance",".","If","variance","is","not","estimated",",","this","value","is","used","instead","of","an","estimate",".","alpha",":","Scalar","multiplier","for","confidence","interval","width",".","Values","above","1.0","make","exploration","more","aggressive",",","below","1.0","less","aggressive"]
code: def var(self):
      # return empirical variance of rewards for each arm
      if self.estimate_variance:
          return torch.fmax(
              self.min_variance,
              self.total_sum_reward_squared_per_arm
              / self.total_n_obs_per_arm
              - (
                  (
                      self.total_sum_reward_per_arm
                      / self.total_n_obs_per_arm
                  )
                  ** 2
              ),
          )
      else:
          return self.min_variance
  
imports: import math
  from abc import ABC, abstractmethod
  from typing import List, Optional
  import torch
  from reagent.mab.mab_algorithm import MABAlgo
  from torch import Tensor
label_desc: Use image node_id 2 for calling the BaseUCB obj's underlying member method code with example usage: obj.var() and returns: torch, self