class_docstr: A Quasi Monte Carlo Sampler that generates low-discrepancy sequences.
  
  Quasi Monte Carlo (QMC) sequences are designed to have lower discrepancies than
  standard random sequences. They are known to perform better than the standard
  random sequences in hyperparameter optimization.
  
  For further information about the use of QMC sequences for hyperparameter optimization,
  please refer to the following paper:
  
  - `Bergstra, James, and Yoshua Bengio. Random search for hyper-parameter optimization.
    Journal of machine learning research 13.2, 2012.
    <https://jmlr.org/papers/v13/bergstra12a.html>`_
  
  We use the QMC implementations in Scipy. For the details of the QMC algorithm,
  see the Scipy API references on `scipy.stats.qmc
  <https://scipy.github.io/devdocs/reference/stats.qmc.html>`_.
  
  .. note:
      If your search space contains categorical parameters, it samples the categorical
      parameters by its `independent_sampler` without using QMC algorithm.
  
  .. note::
      The search space of the sampler is determined by either previous trials in the study or
      the first trial that this sampler samples.
  
      If there are previous trials in the study, :class:`~optuna.samplers.QMCSampler` infers its
      search space using the trial which was created first in the study.
  
      Otherwise (if the study has no previous trials), :class:`~optuna.samplers.QMCSampler`
      samples the first trial using its `independent_sampler` and then infers the search space
      in the second trial.
  
      As mentioned above, the search space of the :class:`~optuna.samplers.QMCSampler` is
      determined by the first trial of the study. Once the search space is determined, it cannot
      be changed afterwards.
  
  Args:
      qmc_type:
          The type of QMC sequence to be sampled. This must be one of
          `"halton"` and `"sobol"`. Default is `"sobol"`.
  
          .. note::
              Sobol' sequence is designed to have low-discrepancy property when the number of
              samples is :math:`n=2^m` for each positive integer :math:`m`. When it is possible
              to pre-specify the number of trials suggested by `QMCSampler`, it is recommended
              that the number of trials should be set as power of two.
  
      scramble:
          If this option is :obj:`True`, scrambling (randomization) is applied to the QMC
          sequences.
  
      seed:
          A seed for ``QMCSampler``. This argument is used only when ``scramble`` is :obj:`True`.
          If this is :obj:`None`, the seed is initialized randomly. Default is :obj:`None`.
  
          .. note::
              When using multiple :class:`~optuna.samplers.QMCSampler`'s in parallel and/or
              distributed optimization, all the samplers must share the same seed when the
              `scrambling` is enabled. Otherwise, the low-discrepancy property of the samples
              will be degraded.
  
      independent_sampler:
          A :class:`~optuna.samplers.BaseSampler` instance that is used for independent
          sampling. The first trial of the study and the parameters not contained in the
          relative search space are sampled by this sampler.
  
          If :obj:`None` is specified, :class:`~optuna.samplers.RandomSampler` is used
          as the default.
  
          .. seealso::
              :class:`~optuna.samplers` module provides built-in independent samplers
              such as :class:`~optuna.samplers.RandomSampler` and
              :class:`~optuna.samplers.TPESampler`.
  
      warn_independent_sampling:
          If this is :obj:`True`, a warning message is emitted when
          the value of a parameter is sampled by using an independent sampler.
  
          Note that the parameters of the first trial in a study are sampled via an
          independent sampler in most cases, so no warning messages are emitted in such cases.
  
      warn_asynchronous_seeding:
          If this is :obj:`True`, a warning message is emitted when the scrambling
          (randomization) is applied to the QMC sequence and the random seed of the sampler is
          not set manually.
  
          .. note::
              When using parallel and/or distributed optimization without manually
              setting the seed, the seed is set randomly for each instances of
              :class:`~optuna.samplers.QMCSampler` for different workers, which ends up
              asynchronous seeding for multiple samplers used in the optimization.
  
          .. seealso::
              See parameter ``seed`` in :class:`~optuna.samplers.QMCSampler`.
  
  Example:
  
      Optimize a simple quadratic function by using :class:`~optuna.samplers.QMCSampler`.
  
      .. testcode::
  
          import optuna
  
  
          def objective(trial):
              x = trial.suggest_float("x", -1, 1)
              y = trial.suggest_int("y", -1, 1)
              return x**2 + y
  
  
          sampler = optuna.samplers.QMCSampler()
          study = optuna.create_study(sampler=sampler)
          study.optimize(objective, n_trials=8)
class_docstr_tok: ["A","Quasi","Monte","Carlo","Sampler","that","generates","low-discrepancy","sequences",".","Quasi","Monte","Carlo","(","QMC",")","sequences","are","designed","to","have","lower","discrepancies","than","standard","random","sequences",".","They","are","known","to","perform","better","than","the","standard","random","sequences","in","hyperparameter","optimization",".","For","further","information","about","the","use","of","QMC","sequences","for","hyperparameter","optimization",",","please","refer","to","the","following","paper",":","-","`","Bergstra",",","James",",","and","Yoshua","Bengio",".","Random","search","for","hyper-parameter","optimization",".","Journal","of","machine","learning","research","13.2",",","2012",".","<","https",":","\/\/jmlr.org\/papers\/v13\/bergstra12a.html",">","`","_","We","use","the","QMC","implementations","in","Scipy",".","For","the","details","of","the","QMC","algorithm",",","see","the","Scipy","API","references","on","`","scipy.stats.qmc","<","https",":","\/\/scipy.github.io\/devdocs\/reference\/stats.qmc.html",">","`","_",".","..","note",":","If","your","search","space","contains","categorical","parameters",",","it","samples","the","categorical","parameters","by","its","`","independent_sampler","`","without","using","QMC","algorithm",".","..","note",":",":","The","search","space","of","the","sampler","is","determined","by","either","previous","trials","in","the","study","or","the","first","trial","that","this","sampler","samples",".","If","there","are","previous","trials","in","the","study",",",":","class",":","`","~optuna.samplers.QMCSampler","`","infers","its","search","space","using","the","trial","which","was","created","first","in","the","study",".","Otherwise","(","if","the","study","has","no","previous","trials",")",",",":","class",":","`","~optuna.samplers.QMCSampler","`","samples","the","first","trial","using","its","`","independent_sampler","`","and","then","infers","the","search","space","in","the","second","trial",".","As","mentioned","above",",","the","search","space","of","the",":","class",":","`","~optuna.samplers.QMCSampler","`","is","determined","by","the","first","trial","of","the","study",".","Once","the","search","space","is","determined",",","it","can","not","be","changed","afterwards",".","Args",":","qmc_type",":","The","type","of","QMC","sequence","to","be","sampled",".","This","must","be","one","of","`","``","halton","''","`","and","`","``","sobol","''","`",".","Default","is","`","``","sobol","''","`",".","..","note",":",":","Sobol","'","sequence","is","designed","to","have","low-discrepancy","property","when","the","number","of","samples","is",":","math",":","`","n=2^m","`","for","each","positive","integer",":","math",":","`","m","`",".","When","it","is","possible","to","pre-specify","the","number","of","trials","suggested","by","`","QMCSampler","`",",","it","is","recommended","that","the","number","of","trials","should","be","set","as","power","of","two",".","scramble",":","If","this","option","is",":","obj",":","`","True","`",",","scrambling","(","randomization",")","is","applied","to","the","QMC","sequences",".","seed",":","A","seed","for","``","QMCSampler","``",".","This","argument","is","used","only","when","``","scramble","``","is",":","obj",":","`","True","`",".","If","this","is",":","obj",":","`","None","`",",","the","seed","is","initialized","randomly",".","Default","is",":","obj",":","`","None","`",".","..","note",":",":","When","using","multiple",":","class",":","`","~optuna.samplers.QMCSampler","`","'s","in","parallel","and\/or","distributed","optimization",",","all","the","samplers","must","share","the","same","seed","when","the","`","scrambling","`","is","enabled",".","Otherwise",",","the","low-discrepancy","property","of","the","samples","will","be","degraded",".","independent_sampler",":","A",":","class",":","`","~optuna.samplers.BaseSampler","`","instance","that","is","used","for","independent","sampling",".","The","first","trial","of","the","study","and","the","parameters","not","contained","in","the","relative","search","space","are","sampled","by","this","sampler",".","If",":","obj",":","`","None","`","is","specified",",",":","class",":","`","~optuna.samplers.RandomSampler","`","is","used","as","the","default",".","..","seealso",":",":",":","class",":","`","~optuna.samplers","`","module","provides","built-in","independent","samplers","such","as",":","class",":","`","~optuna.samplers.RandomSampler","`","and",":","class",":","`","~optuna.samplers.TPESampler","`",".","warn_independent_sampling",":","If","this","is",":","obj",":","`","True","`",",","a","warning","message","is","emitted","when","the","value","of","a","parameter","is","sampled","by","using","an","independent","sampler",".","Note","that","the","parameters","of","the","first","trial","in","a","study","are","sampled","via","an","independent","sampler","in","most","cases",",","so","no","warning","messages","are","emitted","in","such","cases",".","warn_asynchronous_seeding",":","If","this","is",":","obj",":","`","True","`",",","a","warning","message","is","emitted","when","the","scrambling","(","randomization",")","is","applied","to","the","QMC","sequence","and","the","random","seed","of","the","sampler","is","not","set","manually",".","..","note",":",":","When","using","parallel","and\/or","distributed","optimization","without","manually","setting","the","seed",",","the","seed","is","set","randomly","for","each","instances","of",":","class",":","`","~optuna.samplers.QMCSampler","`","for","different","workers",",","which","ends","up","asynchronous","seeding","for","multiple","samplers","used","in","the","optimization",".","..","seealso",":",":","See","parameter","``","seed","``","in",":","class",":","`","~optuna.samplers.QMCSampler","`",".","Example",":","Optimize","a","simple","quadratic","function","by","using",":","class",":","`","~optuna.samplers.QMCSampler","`",".","..","testcode",":",":","import","optuna","def","objective","(","trial",")",":","x","=","trial.suggest_float","(","``","x","''",",","-1",",","1",")","y","=","trial.suggest_int","(","``","y","''",",","-1",",","1",")","return","x","*","*","2","+","y","sampler","=","optuna.samplers.QMCSampler","(",")","study","=","optuna.create_study","(","sampler=sampler",")","study.optimize","(","objective",",","n_trials=8",")"]
code: def __init__(
      self,
      *,
      qmc_type: str = "sobol",
      scramble: bool = False,  # default is False for simplicity in distributed environment.
      seed: Optional[int] = None,
      independent_sampler: Optional[BaseSampler] = None,
      warn_asynchronous_seeding: bool = True,
      warn_independent_sampling: bool = True,
  ) -> None:
      self._scramble = scramble
      self._seed = (
          np.random.PCG64().random_raw() if seed is None else seed
      )
      self._independent_sampler = (
          independent_sampler
          or optuna.samplers.RandomSampler(seed=seed)
      )
      self._initial_search_space: Optional[
          Dict[str, BaseDistribution]
      ] = None
      self._warn_independent_sampling = warn_independent_sampling
  
      if qmc_type in ("halton", "sobol"):
          self._qmc_type = qmc_type
      else:
          message = (
              f'The `qmc_type`, "{qmc_type}", is not a valid. '
              'It must be one of "halton" and "sobol".'
          )
          raise ValueError(message)
  
      if seed is None and scramble and warn_asynchronous_seeding:
          # Sobol/Halton sequences without scrambling do not use seed.
          self._log_asynchronous_seeding()
  
imports: from typing import Any
  from typing import Dict
  from typing import Optional
  from typing import Sequence
  import numpy
  import optuna
  from optuna import logging
  from optuna._experimental import experimental_class
  from optuna._imports import _LazyImport
  from optuna._transform import _SearchSpaceTransform
  from optuna.distributions import BaseDistribution
  from optuna.distributions import CategoricalDistribution
  from optuna.samplers import BaseSampler
  from optuna.study import Study
  from optuna.trial import FrozenTrial
  from optuna.trial import TrialState
label_desc: Use image node_id 1 to create a new QMCSampler object from inherited base classes: BaseSampler with example: obj = QMCSampler()