deephyper.skopt.sampler.sobol.Space#
- class deephyper.skopt.sampler.sobol.Space(dimensions, model_sdv=None, config_space=None)[source]#
Bases:
object
Initialize a search space from given specifications.
- 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).
Note
The upper and lower bounds are inclusive for Integer dimensions.
Methods
When ConfigSpace is used, it will return the "lower" bound of inactive parameters.
Compute distance between two points in this space.
Create a
Space
from yaml configuration file.Returns all transformers as list.
Inverse transform samples from the warped space back to the original space.
Draw random samples.
Sets the transformer of all dimension objects to
transform
.Sets the transformer of
dim_type
objects totransform
.Transform samples from the original space into a warped space.
Update the prior of the dimensions.
Attributes
The dimension bounds, in the original space.
Names of all the dimensions in the search-space.
Space contains exclusively categorical dimensions.
Space contains any categorical dimensions.
Returns true if all dimensions are Real.
Returns the number of constant dimensions which have zero degree of freedom, e.g. an Integer dimensions with (0., 0.) as bounds.
The dimensionality of the original space.
The dimension bounds, in the warped space.
The dimensionality of the warped space.
- property bounds#
The dimension bounds, in the original space.
- deactivate_inactive_dimensions(x)[source]#
When ConfigSpace is used, it will return the “lower” bound of inactive parameters.
- property dimension_names#
Names of all the dimensions in the search-space.
- distance(point_a, point_b)[source]#
Compute distance between two points in this space.
Args: point_a : array
First point.
- point_barray
Second point.
- classmethod from_yaml(yml_path, namespace=None)[source]#
Create a
Space
from yaml configuration file.- Parameters:
yml_path (str) –
Full path to yaml configuration file, example YaML below: Space:
Integer:
low: -5 high: 5 - Categorical: categories: - a - b - Real: low: 1.0 high: 5.0 prior: log-uniform
namespace – str, default=None
use (Namespace within configuration file to)
first (will use)
provided (namespace if not)
- Returns:
Instantiated Space object.
- Return type:
space (Space)
- inverse_transform(Xt)[source]#
Inverse transform samples from the warped space back to the original space.
- Parameters:
Xt (array of floats, shape=(n_samples, transformed_n_dims)) – The samples to inverse transform.
- Returns:
The original samples.
- Return type:
X (list of lists, shape=(n_samples, n_dims))
- property is_categorical#
Space contains exclusively categorical dimensions.
- property is_partly_categorical#
Space contains any categorical dimensions.
- property is_real#
Returns true if all dimensions are Real.
- property n_constant_dimensions#
Returns the number of constant dimensions which have zero degree of freedom, e.g. an Integer dimensions with (0., 0.) as bounds.
- property n_dims#
The dimensionality of the original space.
- rvs(n_samples=1, random_state=None, n_jobs=1)[source]#
Draw random samples.
The samples are in the original space. They need to be transformed before being passed to a model or minimizer by
space.transform()
.- Parameters:
- Returns:
Points sampled from the space.
- Return type:
points (list of lists, shape=(n_points, n_dims))
- set_transformer_by_type(transform, dim_type)[source]#
Sets the transformer of
dim_type
objects totransform
.
- transform(X)[source]#
Transform samples from the original space into a warped space.
- Note: this transformation is expected to be used to project samples
into a suitable space for numerical optimization.
- Parameters:
X (list of lists, shape=(n_samples, n_dims)) – The samples to transform.
- Returns:
The transformed samples.
- Return type:
Xt (array of floats, shape=(n_samples, transformed_n_dims))
- property transformed_bounds#
The dimension bounds, in the warped space.
- property transformed_n_dims#
The dimensionality of the warped space.