Skip to main content
`Ctrl`+`K`

# `skopt.sampler`.Lhs

class skopt.sampler.Lhs(lhs_type='classic', criterion='maximin', iterations=1000)

  Latin hypercube sampling.

  Parameters:
    lhs_type str, default=’classic’

      - ‘classic’ - a small random number is added

      - ‘centered’ - points are set uniformly in each interval

    criterion str or None, default=’maximin’

      When set to None, the LHS is not optimized

      - ‘correlation’ : optimized LHS by minimizing the correlation

      - ‘maximin’ : optimized LHS by maximizing the minimal pdist

      - ‘ratio’ : optimized LHS by minimizing the ratio `max(pdist) / min(pdist)`

    iterations int

      Defines the number of iterations for optimizing LHS

  Methods

  `generate`(dimensions, n_samples[, random_state]) | Creates latin hypercube samples.
  `set_params`(**params) | Set the parameters of this initial point generator.

  __init__(lhs_type='classic', criterion='maximin', iterations=1000)
  generate(dimensions, n_samples, random_state=None)

    Creates latin hypercube samples.

    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 LHS 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)

        LHS set

  set_params(**params)

    Set the parameters of this initial point generator.

    Parameters:
      **params dict

        Generator parameters.

      Returns
      ——-
      self object

        Generator instance.