class_docstr: The Thompson Sampling MAB with Normal-Gamma distribution for rewards.
  Appropriate for MAB with normally distributed rewards.
  We use posterior update equations from
      https://en.wikipedia.org/wiki/Normal-gamma_distribution#Posterior_distribution_of_the_parameters
class_docstr_tok: ["The","Thompson","Sampling","MAB","with","Normal-Gamma","distribution","for","rewards",".","Appropriate","for","MAB","with","normally","distributed","rewards",".","We","use","posterior","update","equations","from","https",":","\/\/en.wikipedia.org\/wiki\/Normal-gamma_distribution","#","Posterior_distribution_of_the_parameters"]
code: def add_single_observation(self, arm_id: str, reward: float) -> None:
      super().add_single_observation(arm_id=arm_id, reward=reward)
      arm_idx = self.arm_ids.index(arm_id)
      lambda_ = (
          self.lambda_0 + self.total_n_obs_per_arm[arm_idx] - 1
      )  # -1 bcs counter is already incremented by super() call
      self.gamma_rates[arm_idx] += (
          0.5
          * (reward - self.mus[arm_idx]) ** 2
          * lambda_
          / (lambda_ + 1)
      )
      self.mus[arm_idx] += (reward - self.mus[arm_idx]) / (lambda_ + 1)
  
file_path: ReAgent/reagent/mab/thompson_sampling.py
imports: from abc import abstractmethod
  from typing import List, Optional
  import torch
  from reagent.mab.mab_algorithm import MABAlgo, reindex_multiple_tensors
  from torch import Tensor
label_desc: Use image node_id 2 for calling the NormalGammaThompson obj's underlying member method code with example usage: obj.add_single_observation(arm_id, reward) without return types