class_docstr: Grid of parameters with a discrete number of values for each.
  
  Can be used to iterate over parameter value combinations with the
  Python built-in function iter.
  The order of the generated parameter combinations is deterministic.
  
  Read more in the :ref:`User Guide <grid_search>`.
  
  Parameters
  ----------
  param_grid : dict of str to sequence, or sequence of such
      The parameter grid to explore, as a dictionary mapping estimator
      parameters to sequences of allowed values.
  
      An empty dict signifies default parameters.
  
      A sequence of dicts signifies a sequence of grids to search, and is
      useful to avoid exploring parameter combinations that make no sense
      or have no effect. See the examples below.
  
  Examples
  --------
  >>> from sklearn.model_selection import ParameterGrid
  >>> param_grid = {'a': [1, 2], 'b': [True, False]}
  >>> list(ParameterGrid(param_grid)) == (
  ...    [{'a': 1, 'b': True}, {'a': 1, 'b': False},
  ...     {'a': 2, 'b': True}, {'a': 2, 'b': False}])
  True
  
  >>> grid = [{'kernel': ['linear']}, {'kernel': ['rbf'], 'gamma': [1, 10]}]
  >>> list(ParameterGrid(grid)) == [{'kernel': 'linear'},
  ...                               {'kernel': 'rbf', 'gamma': 1},
  ...                               {'kernel': 'rbf', 'gamma': 10}]
  True
  >>> ParameterGrid(grid)[1] == {'kernel': 'rbf', 'gamma': 1}
  True
  
  See Also
  --------
  GridSearchCV : Uses :class:`ParameterGrid` to perform a full parallelized
      parameter search.
class_docstr_tok: ["Grid","of","parameters","with","a","discrete","number","of","values","for","each",".","Can","be","used","to","iterate","over","parameter","value","combinations","with","the","Python","built-in","function","iter",".","The","order","of","the","generated","parameter","combinations","is","deterministic",".","Read","more","in","the",":","ref",":","`","User","Guide","<","grid_search",">","`",".","Parameters","--","--","--","--","--","param_grid",":","dict","of","str","to","sequence",",","or","sequence","of","such","The","parameter","grid","to","explore",",","as","a","dictionary","mapping","estimator","parameters","to","sequences","of","allowed","values",".","An","empty","dict","signifies","default","parameters",".","A","sequence","of","dicts","signifies","a","sequence","of","grids","to","search",",","and","is","useful","to","avoid","exploring","parameter","combinations","that","make","no","sense","or","have","no","effect",".","See","the","examples","below",".","Examples","--","--","--","--",">",">",">","from","sklearn.model_selection","import","ParameterGrid",">",">",">","param_grid","=","{","'","a","'",":","[","1",",","2","]",",","'","b","'",":","[","True",",","False","]","}",">",">",">","list","(","ParameterGrid","(","param_grid",")",")","==","(","...","[","{","'","a","'",":","1",",","'","b","'",":","True","}",",","{","'","a","'",":","1",",","'","b","'",":","False","}",",","...","{","'","a","'",":","2",",","'","b","'",":","True","}",",","{","'","a","'",":","2",",","'","b","'",":","False","}","]",")","True",">",">",">","grid","=","[","{","'kernel","'",":","[","'linear","'","]","}",",","{","'kernel","'",":","[","'rbf","'","]",",","'gamma","'",":","[","1",",","10","]","}","]",">",">",">","list","(","ParameterGrid","(","grid",")",")","==","[","{","'kernel","'",":","'linear","'","}",",","...","{","'kernel","'",":","'rbf","'",",","'gamma","'",":","1","}",",","...","{","'kernel","'",":","'rbf","'",",","'gamma","'",":","10","}","]","True",">",">",">","ParameterGrid","(","grid",")","[","1","]","==","{","'kernel","'",":","'rbf","'",",","'gamma","'",":","1","}","True","See","Also","--","--","--","--","GridSearchCV",":","Uses",":","class",":","`","ParameterGrid","`","to","perform","a","full","parallelized","parameter","search","."]
docstr: Number of points on the grid.
docstr_tok: ["Number","of","points","on","the","grid","."]
code: def __len__(self):
      """Number of points on the grid."""
      # Product function that can handle iterables (np.prod can't).
      product = partial(reduce, operator.mul)
      return sum(
          product(len(v) for v in p.values()) if p else 1
          for p in self.param_grid
      )
  
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, _MultimetricScorer, get_scorer_names
  from ..utils import Bunch, check_random_state
  from ..utils._param_validation import HasMethods, Interval, StrOptions
  from ..utils._tags import _safe_tags
  from ..utils.metadata_routing import MetadataRouter, MethodMapping, _raise_for_params, _routing_enabled, process_routing
  from ..utils.metaestimators import available_if
  from ..utils.parallel import Parallel, delayed
  from ..utils.random import sample_without_replacement
  from ..utils.validation import _check_method_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 3 for calling the ParameterGrid obj's underlying member method code with example usage: obj.__len__() and returns: sum