class_docstr: Generator on parameters sampled from given distributions.
  
  Non-deterministic iterable over random candidate combinations for hyper-
  parameter search. If all parameters are presented as a list,
  sampling without replacement is performed. If at least one parameter
  is given as a distribution, sampling with replacement is used.
  It is highly recommended to use continuous distributions for continuous
  parameters.
  
  Read more in the :ref:`User Guide <grid_search>`.
  
  Parameters
  ----------
  param_distributions : dict
      Dictionary with parameters names (`str`) as keys and distributions
      or lists of parameters to try. Distributions must provide a ``rvs``
      method for sampling (such as those from scipy.stats.distributions).
      If a list is given, it is sampled uniformly.
      If a list of dicts is given, first a dict is sampled uniformly, and
      then a parameter is sampled using that dict as above.
  
  n_iter : int
      Number of parameter settings that are produced.
  
  random_state : int, RandomState instance or None, default=None
      Pseudo random number generator state used for random uniform sampling
      from lists of possible values instead of scipy.stats distributions.
      Pass an int for reproducible output across multiple
      function calls.
      See :term:`Glossary <random_state>`.
  
  Returns
  -------
  params : dict of str to any
      **Yields** dictionaries mapping each estimator parameter to
      as sampled value.
  
  Examples
  --------
  >>> from sklearn.model_selection import ParameterSampler
  >>> from scipy.stats.distributions import expon
  >>> import numpy as np
  >>> rng = np.random.RandomState(0)
  >>> param_grid = {'a':[1, 2], 'b': expon()}
  >>> param_list = list(ParameterSampler(param_grid, n_iter=4,
  ...                                    random_state=rng))
  >>> rounded_list = [dict((k, round(v, 6)) for (k, v) in d.items())
  ...                 for d in param_list]
  >>> rounded_list == [{'b': 0.89856, 'a': 1},
  ...                  {'b': 0.923223, 'a': 1},
  ...                  {'b': 1.878964, 'a': 2},
  ...                  {'b': 1.038159, 'a': 2}]
  True
class_docstr_tok: ["Generator","on","parameters","sampled","from","given","distributions",".","Non-deterministic","iterable","over","random","candidate","combinations","for","hyper-","parameter","search",".","If","all","parameters","are","presented","as","a","list",",","sampling","without","replacement","is","performed",".","If","at","least","one","parameter","is","given","as","a","distribution",",","sampling","with","replacement","is","used",".","It","is","highly","recommended","to","use","continuous","distributions","for","continuous","parameters",".","Read","more","in","the",":","ref",":","`","User","Guide","<","grid_search",">","`",".","Parameters","--","--","--","--","--","param_distributions",":","dict","Dictionary","with","parameters","names","(","`","str","`",")","as","keys","and","distributions","or","lists","of","parameters","to","try",".","Distributions","must","provide","a","``","rvs","``","method","for","sampling","(","such","as","those","from","scipy.stats.distributions",")",".","If","a","list","is","given",",","it","is","sampled","uniformly",".","If","a","list","of","dicts","is","given",",","first","a","dict","is","sampled","uniformly",",","and","then","a","parameter","is","sampled","using","that","dict","as","above",".","n_iter",":","int","Number","of","parameter","settings","that","are","produced",".","random_state",":","int",",","RandomState","instance","or","None",",","default=None","Pseudo","random","number","generator","state","used","for","random","uniform","sampling","from","lists","of","possible","values","instead","of","scipy.stats","distributions",".","Pass","an","int","for","reproducible","output","across","multiple","function","calls",".","See",":","term",":","`","Glossary","<","random_state",">","`",".","Returns","--","--","--","-","params",":","dict","of","str","to","any","*","*","Yields","*","*","dictionaries","mapping","each","estimator","parameter","to","as","sampled","value",".","Examples","--","--","--","--",">",">",">","from","sklearn.model_selection","import","ParameterSampler",">",">",">","from","scipy.stats.distributions","import","expon",">",">",">","import","numpy","as","np",">",">",">","rng","=","np.random.RandomState","(","0",")",">",">",">","param_grid","=","{","'","a","'",":","[","1",",","2","]",",","'","b","'",":","expon","(",")","}",">",">",">","param_list","=","list","(","ParameterSampler","(","param_grid",",","n_iter=4",",","...","random_state=rng",")",")",">",">",">","rounded_list","=","[","dict","(","(","k",",","round","(","v",",","6",")",")","for","(","k",",","v",")","in","d.items","(",")",")","...","for","d","in","param_list","]",">",">",">","rounded_list","==","[","{","'","b","'",":","0.89856",",","'","a","'",":","1","}",",","...","{","'","b","'",":","0.923223",",","'","a","'",":","1","}",",","...","{","'","b","'",":","1.878964",",","'","a","'",":","2","}",",","...","{","'","b","'",":","1.038159",",","'","a","'",":","2","}","]","True"]
docstr: Number of points that will be sampled.
docstr_tok: ["Number","of","points","that","will","be","sampled","."]
code: def __len__(self):
      """Number of points that will be sampled."""
      if self._is_all_lists():
          grid_size = len(ParameterGrid(self.param_distributions))
          return min(self.n_iter, grid_size)
      else:
          return self.n_iter
  
imports: import numbers
  import operator
  import time
  import warnings
  from abc import ABCMeta, abstractmethod
  from collections import defaultdict
  from collections.abc import Iterable, Mapping, Sequence
  from functools import partial, reduce
  from itertools import product
  import numpy
  from numpy.ma import MaskedArray
  from scipy.stats import rankdata
  from ..base import BaseEstimator, MetaEstimatorMixin, _fit_context, clone, is_classifier
  from ..exceptions import NotFittedError
  from ..metrics import check_scoring
  from ..metrics._scorer import _check_multimetric_scoring, get_scorer_names
  from ..utils import check_random_state
  from ..utils._param_validation import HasMethods, Interval, StrOptions
  from ..utils._tags import _safe_tags
  from ..utils.metaestimators import available_if
  from ..utils.parallel import Parallel, delayed
  from ..utils.random import sample_without_replacement
  from ..utils.validation import _check_fit_params, check_is_fitted, indexable
  from ._split import check_cv
  from ._validation import _aggregate_score_dicts, _fit_and_score, _insert_error_scores, _normalize_score_results, _warn_or_raise_about_fit_failures
label_desc: Use image node_id 4 for calling the ParameterSampler obj's underlying member method code with example usage: obj.__len__() and returns: min, self