class_docstr: Generator for Thompson sampling.
  
  The generator performs Thompson sampling on the data passed in via `fit`.
  Arms are given weight proportional to the probability that they are
  winners, according to Monte Carlo simulations.
class_docstr_tok: ["Generator","for","Thompson","sampling",".","The","generator","performs","Thompson","sampling","on","the","data","passed","in","via","`","fit","`",".","Arms","are","given","weight","proportional","to","the","probability","that","they","are","winners",",","according","to","Monte","Carlo","simulations","."]
docstr: Args:
      num_samples: The number of samples to draw from the posterior.
      min_weight: The minimum weight a arm must be
          given in order for it to be returned from the gernerator. If not
          specified, will be set to 2 / (number of arms).
      uniform_weights: If True, the arms returned from the
          generator will each be given a weight of 1 / (number of arms).
docstr_tok: ["Args",":","num_samples",":","The","number","of","samples","to","draw","from","the","posterior",".","min_weight",":","The","minimum","weight","a","arm","must","be","given","in","order","for","it","to","be","returned","from","the","gernerator",".","If","not","specified",",","will","be","set","to","2","\/","(","number","of","arms",")",".","uniform_weights",":","If","True",",","the","arms","returned","from","the","generator","will","each","be","given","a","weight","of","1","\/","(","number","of","arms",")","."]
code: def __init__(
      self,
      num_samples: int = 10000,
      min_weight: Optional[float] = None,
      uniform_weights: bool = False,
  ) -> None:
      """
      Args:
          num_samples: The number of samples to draw from the posterior.
          min_weight: The minimum weight a arm must be
              given in order for it to be returned from the gernerator. If not
              specified, will be set to 2 / (number of arms).
          uniform_weights: If True, the arms returned from the
              generator will each be given a weight of 1 / (number of arms).
      """
      self.num_samples = num_samples
      self.min_weight = min_weight
      self.uniform_weights = uniform_weights
  
      # pyre-fixme[4]: Attribute must be annotated.
      self.X = None
      # pyre-fixme[4]: Attribute must be annotated.
      self.Ys = None
      # pyre-fixme[4]: Attribute must be annotated.
      self.Yvars = None
      # pyre-fixme[4]: Attribute must be annotated.
      self.X_to_Ys_and_Yvars = None
  
imports: import hashlib
  import json
  from typing import Dict, List, Optional, Tuple
  import numpy
  from ax.core.types import TGenMetadata, TParamValue, TParamValueList
  from ax.exceptions.constants import TS_MIN_WEIGHT_ERROR, TS_NO_FEASIBLE_ARMS_ERROR
  from ax.exceptions.model import ModelError
  from ax.models.discrete_base import DiscreteModel
  from ax.models.types import TConfig
  from ax.utils.common.docutils import copy_doc
label_desc: Use image node_id 1 to create a new ThompsonSampler object from inherited base classes: DiscreteModel with example: obj = ThompsonSampler(num_samples, min_weight, uniform_weights)