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"]
docstr: Get samples from the posterior distributions of arm rewards
docstr_tok: ["Get","samples","from","the","posterior","distributions","of","arm","rewards"]
code: def _get_posterior_samples(self) -> Tensor:
      """
      Get samples from the posterior distributions of arm rewards
      """
      precisions = (
          self.lambda_0 + self.total_n_obs_per_arm
      ) * torch.distributions.gamma.Gamma(
          0.5 * (self.total_n_obs_per_arm + self.alpha_0),
          self.gamma_rates,
      ).sample()
      return torch.distributions.normal.Normal(
          self.mus,
          # pyre-fixme[58]: `/` is not supported for operand types `float` and
          #  `Tensor`.
          1.0 / torch.sqrt(precisions),
      ).sample()
  
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 4 for calling the NormalGammaThompson obj's underlying member method code with example usage: obj._get_posterior_samples() and returns: torch