class_docstr: Gaussian Mixture Model Sampler for TPE algorithm
  
  Parameters
  ----------
  tpe: `TPE` algorithm
      The tpe algorithm object which this sampler will be part of.
  mus: list
      mus for each Gaussian components in the GMM.
      Default: ``None``
  sigmas: list
      sigmas for each Gaussian components in the GMM.
  low: real
      Lower bound of the sampled points.
  high: real
      Upper bound of the sampled points.
  weights: list
      Weights for each Gaussian components in the GMM
      Default: ``None``
  base_attempts: int, optional
      Base number of attempts to sample points within `low` and `high` bounds.
      Defaults to 10.
  attempts_factor: int, optional
      If sampling always falls out of bound try again with `attempts` * `attempts_factor`.
      Defaults to 10.
  max_attempts: int, optional
      If sampling always falls out of bound try again with `attempts` * `attempts_factor`
      up to `max_attempts` (inclusive).
      Defaults to 10000.
class_docstr_tok: ["Gaussian","Mixture","Model","Sampler","for","TPE","algorithm","Parameters","--","--","--","--","--","tpe",":","`","TPE","`","algorithm","The","tpe","algorithm","object","which","this","sampler","will","be","part","of",".","mus",":","list","mus","for","each","Gaussian","components","in","the","GMM",".","Default",":","``","None","``","sigmas",":","list","sigmas","for","each","Gaussian","components","in","the","GMM",".","low",":","real","Lower","bound","of","the","sampled","points",".","high",":","real","Upper","bound","of","the","sampled","points",".","weights",":","list","Weights","for","each","Gaussian","components","in","the","GMM","Default",":","``","None","``","base_attempts",":","int",",","optional","Base","number","of","attempts","to","sample","points","within","`","low","`","and","`","high","`","bounds",".","Defaults","to","10.","attempts_factor",":","int",",","optional","If","sampling","always","falls","out","of","bound","try","again","with","`","attempts","`","*","`","attempts_factor","`",".","Defaults","to","10.","max_attempts",":","int",",","optional","If","sampling","always","falls","out","of","bound","try","again","with","`","attempts","`","*","`","attempts_factor","`","up","to","`","max_attempts","`","(","inclusive",")",".","Defaults","to","10000","."]
docstr: Sample required number of points
code: def sample(
      self, num: int = 1, attempts: int | None = None
  ) -> list[numpy.ndarray]:
      """Sample required number of points"""
      if attempts is None:
          attempts = self.base_attempts
      point: list[numpy.ndarray] = []
      for _ in range(num):
          pdf = numpy.argmax(self.tpe.rng.multinomial(1, self.weights))
          attempts_tried = 0
          index: int | None = None
          while attempts_tried < attempts:
              new_points: numpy.ndarray = self.pdfs[pdf].rvs(
                  size=attempts, random_state=self.tpe.rng
              )
              valid_points = (self.low <= new_points) * (
                  self.high >= new_points
              )
  
              if any(valid_points):
                  index = numpy.argmax(valid_points)
                  point.append(new_points[index])
                  break
  
              index = None
              attempts_tried += 1
  
          if index is None and attempts >= self.max_attempts:
              raise RuntimeError(
                  f"Failed to sample in interval ({self.low}, {self.high})"
              )
          elif index is None:
              point.append(
                  self.sample(
                      num=1, attempts=attempts * self.attempts_factor
                  )[0]
              )
  
      return point
  
imports: from __future__ import annotations
  import logging
  from typing import Any, Callable, ClassVar, Iterable, Sequence, TypeVar
  import numpy
  from scipy.stats import norm
  from scipy.stats.distributions import rv_frozen
  from orion.algo.base import BaseAlgorithm
  from orion.algo.base.parallel_strategy import ParallelStrategy, strategy_factory
  from orion.algo.space import Integer, Real, Space
  from orion.core.utils import format_trials
  from orion.core.utils.flatten import flatten
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 3 for calling the GMMSampler obj's underlying member method code with example usage: obj.sample(num, attempts) and returns: point