class_docstr: Generate samples from a regular grid.
  
  Parameters
  ----------
  border : str, default='exclude'
      defines how the samples are generated:
      - 'include' : Includes the border into the grid layout
      - 'exclude' : Excludes the border from the grid layout
      - 'only' : Selects only points at the border of the dimension
  use_full_layout : boolean, default=True
      When True, a  full factorial design is generated and
      missing points are taken from the next larger full factorial
      design, depending on `append_border`
      When False, the next larger  full factorial design is
      generated and points are randomly selected from it.
  append_border : str, default="only"
      When use_full_layout is True, this parameter defines how the missing
      points will be generated from the next larger grid layout:
      - 'include' : Includes the border into the grid layout
      - 'exclude' : Excludes the border from the grid layout
      - 'only' : Selects only points at the border of the dimension
docstr: Creates samples from a regular grid.
  
  Parameters
  ----------
  dimensions : list, shape (n_dims,)
      List of search space dimensions.
      Each search dimension can be defined either as
  
      - a `(lower_bound, upper_bound)` tuple (for `Real` or `Integer`
        dimensions),
      - a `(lower_bound, upper_bound, "prior")` tuple (for `Real`
        dimensions),
      - as a list of categories (for `Categorical` dimensions), or
      - an instance of a `Dimension` object (`Real`, `Integer` or
        `Categorical`).
  
  n_samples : int
      The order of the Halton sequence. Defines the number of samples.
  random_state : int, RandomState instance, or None (default)
      Set random state to something other than None for reproducible
      results.
  
  Returns
  -------
  np.array, shape=(n_dim, n_samples)
      grid set
code: def generate(self, dimensions, n_samples, random_state=None):
      """Creates samples from a regular grid.
  
      Parameters
      ----------
      dimensions : list, shape (n_dims,)
          List of search space dimensions.
          Each search dimension can be defined either as
  
          - a `(lower_bound, upper_bound)` tuple (for `Real` or `Integer`
            dimensions),
          - a `(lower_bound, upper_bound, "prior")` tuple (for `Real`
            dimensions),
          - as a list of categories (for `Categorical` dimensions), or
          - an instance of a `Dimension` object (`Real`, `Integer` or
            `Categorical`).
  
      n_samples : int
          The order of the Halton sequence. Defines the number of samples.
      random_state : int, RandomState instance, or None (default)
          Set random state to something other than None for reproducible
          results.
  
      Returns
      -------
      np.array, shape=(n_dim, n_samples)
          grid set
      """
      rng = check_random_state(random_state)
      space = Space(dimensions)
      n_dim = space.n_dims
      transformer = space.get_transformer()
      space.set_transformer("normalize")
  
      if self.border == "include":
          if self.use_full_layout:
              order = int(np.floor(np.sqrt(n_samples)))
          else:
              order = int(np.ceil(np.sqrt(n_samples)))
          if order < 2:
              order = 2
          h = _create_uniform_grid_include_border(n_dim, order)
      elif self.border == "exclude":
          if self.use_full_layout:
              order = int(np.floor(np.sqrt(n_samples)))
          else:
              order = int(np.ceil(np.sqrt(n_samples)))
          if order < 1:
              order = 1
          h = _create_uniform_grid_exclude_border(n_dim, order)
      elif self.border == "only":
          if self.use_full_layout:
              order = int(np.floor(n_samples / 2.0))
          else:
              order = int(np.ceil(n_samples / 2.0))
          if order < 2:
              order = 2
          h = _create_uniform_grid_exclude_border(n_dim, order)
      else:
          raise ValueError("Wrong value for border")
      if np.size(h, 0) > n_samples:
          rng.shuffle(h)
          h = h[:n_samples, :]
      elif np.size(h, 0) < n_samples:
          if self.append_border == "only":
              order = int(np.ceil((n_samples - np.size(h, 0)) / 2.0))
              if order < 2:
                  order = 2
              h2 = _create_uniform_grid_only_border(n_dim, order)
          elif self.append_border == "include":
              order = int(np.ceil(np.sqrt(n_samples - np.size(h, 0))))
              if order < 2:
                  order = 2
              h2 = _create_uniform_grid_include_border(n_dim, order)
          elif self.append_border == "exclude":
              order = int(np.ceil(np.sqrt(n_samples - np.size(h, 0))))
              if order < 1:
                  order = 1
              h2 = _create_uniform_grid_exclude_border(n_dim, order)
          else:
              raise ValueError("Wrong value for append_border")
          h = np.vstack((h, h2[: (n_samples - np.size(h, 0))]))
          rng.shuffle(h)
      else:
          rng.shuffle(h)
      h = space.inverse_transform(h)
      space.set_transformer(transformer)
      return h
  
file_path: scikit-optimize/skopt/sampler/grid.py
imports: import numpy
  from .base import InitialPointGenerator
  from ..space import Space
  from sklearn.utils import check_random_state
label_desc: Use image node_id 2 for calling the Grid obj's underlying member method code with example usage: obj.generate(dimensions, n_samples, random_state) and returns: h