A ConfigurationSpace is a data structure to describe the configuration space of an algorithm to tune. Possible hyperparameter types are numerical, categorical, conditional and ordinal hyperparameters.

AutoML tools, such as SMAC3 and BOHB are using the configuration space module to sample hyperparameter configurations. Also, auto-sklearn, an automated machine learning toolkit, which frees the machine learning user from algorithm selection and hyperparameter tuning, makes heavy use of the ConfigSpace package.

This simple quickstart tutorial will show you, how to set up your own ConfigurationSpace, and will demonstrate what you can realize with it. This tutorial will include the following steps:

We will show those steps in an exemplary way by creating a ConfigurationSpace for ridge regression. Note that the topics adding constraints, adding forbidden clauses and serialization are explained in the user guide.

Basic Usage

We take a look at a simple ridge regression, which has only one floating hyperparameter \(\alpha\).

The first step is always to create a ConfigurationSpace object. All the hyperparameters and constraints will be added to this object.

>>> import ConfigSpace as CS
>>> cs = CS.ConfigurationSpace(seed=1234)

The hyperparameter \(\alpha\) is chosen to have floating point values from 0 to 1.

>>> import ConfigSpace.hyperparameters as CSH
>>> alpha = CSH.UniformFloatHyperparameter(name='alpha', lower=0, upper=1)

We add it to the ConfigurationSpace object.

>>> cs.add_hyperparameter(alpha)
alpha, Type: UniformFloat, Range: [0.0, 1.0], Default: 0.5

For demonstration purpose, we sample a configuration from the ConfigurationSpace object.

>>> cs.sample_configuration()
  'alpha': 0.1915194503788923,

And that’s it.

To continue reading, visit the user guide section. There are more information about hyperparameters, as well as an introduction to the powerful concepts of Conditions and Forbidden Clauses.