class_docstr: Canonical implementation of UCB1
  Reference: https://www.cs.bham.ac.uk/internal/courses/robotics/lectures/ucb1.pdf
class_docstr_tok: ["Canonical","implementation","of","UCB1","Reference",":","https",":","\/\/www.cs.bham.ac.uk\/internal\/courses\/robotics\/lectures\/ucb1.pdf"]
docstr: Get per-arm UCB scores. The formula is
  UCB_i = AVG([rewards_i]) + SQRT(2*LN(T)/N_i*VAR)
  VAR=1 if estimate_variance==False, otherwise VAR=AVG([rewards_i**2]) - AVG([rewards_i])**2
  
  Returns:
      Tensor: An array of UCB scores (one per arm)
docstr_tok: ["Get","per-arm","UCB","scores",".","The","formula","is","UCB_i","=","AVG","(","[","rewards_i","]",")","+","SQRT","(","2","*","LN","(","T",")","\/N_i","*","VAR",")","VAR=1","if","estimate_variance==False",",","otherwise","VAR=AVG","(","[","rewards_i","*","*","2","]",")","-","AVG","(","[","rewards_i","]",")","*","*","2","Returns",":","Tensor",":","An","array","of","UCB","scores","(","one","per","arm",")"]
code: def get_scores(self) -> Tensor:
      """
      Get per-arm UCB scores. The formula is
      UCB_i = AVG([rewards_i]) + SQRT(2*LN(T)/N_i*VAR)
      VAR=1 if estimate_variance==False, otherwise VAR=AVG([rewards_i**2]) - AVG([rewards_i])**2
  
      Returns:
          Tensor: An array of UCB scores (one per arm)
      """
      avg_rewards = self.get_avg_reward_values()
      log_t_over_ni = (
          math.log(self.total_n_obs_all_arms + 1)
          / self.total_n_obs_per_arm
      )
      # pyre-fixme[6]: For 1st param expected `Tensor` but got `float`.
      return avg_rewards + self.alpha * torch.sqrt(
          2 * log_t_over_ni * self.var
      )
  
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 1 for calling the UCB1 obj's underlying member method code with example usage: obj.get_scores() and returns: unknown