Skip to main content
`Ctrl`+`K`

# `skopt.space.space`.Integer

class skopt.space.space.Integer(low, high, prior='uniform', base=10, transform=None, name=None, dtype=<class 'numpy.int64'>)

  Search space dimension that can take on integer values.

  Parameters:
    low int

      Lower bound (inclusive).

    high int

      Upper bound (inclusive).

    prior“uniform” or “log-uniform”, default=”uniform”

      Distribution to use when sampling random integers for this dimension.

      - If `"uniform"`, integers are sampled uniformly between the lower and upper bounds.

      - If `"log-uniform"`, integers are sampled uniformly between `log(lower, base)` and `log(upper, base)` where log has base `base`.

    base int

      The logarithmic base to use for a log-uniform prior.

      - Default 10, otherwise commonly 2.

    transform“identity”, “normalize”, optional

      The following transformations are supported.

      - “identity”, (default) the transformed space is the same as the original space.

      - “normalize”, the transformed space is scaled to be between 0 and 1.

    name str or None

      Name associated with dimension, e.g., “number of trees”.

    dtype str or dtype, default=np.int64

      integer type which will be used in inverse_transform, can be int, np.int16, np.uint32, np.int32, np.int64 (default). When set to int, `inverse_transform` returns a list instead of a numpy array

  Attributes:
    bounds
    is_constant
    name
    prior
    size
    transformed_bounds
    transformed_size

  Methods

  `distance`(a, b) | Compute distance between point `a` and `b`.
  `inverse_transform`(Xt) | Inverse transform samples from the warped space back into the original space.
  `rvs`([n_samples, random_state]) | Draw random samples.
  `set_transformer`([transform]) | Define _rvs and transformer spaces.
  `transform`(X) | Transform samples form the original space to a warped space.

  __init__(low, high, prior='uniform', base=10, transform=None, name=None, dtype=<class 'numpy.int64'>)
  distance(a, b)

    Compute distance between point `a` and `b`.

    Parameters:
      a int

        First point.

      b int

        Second point.

  inverse_transform(Xt)

    Inverse transform samples from the warped space back into the original space.

  rvs(n_samples=1, random_state=None)

    Draw random samples.

    Parameters:
      n_samples int or None

        The number of samples to be drawn.

      random_state int, RandomState instance, or None (default)

        Set random state to something other than None for reproducible results.

  set_transformer(transform='identity')

    Define _rvs and transformer spaces.

    Parameters:
      transform str

        Can be ‘normalize’ or ‘identity’

  transform(X)

    Transform samples form the original space to a warped space.