Skip to content

Sobol design

smac.initial_design.sobol_design #

SobolInitialDesign #

SobolInitialDesign(*args: Any, **kwargs: Any)

Bases: AbstractInitialDesign

Sobol sequence design with a scrambled Sobol sequence. See scipy.github.io/devdocs/reference/generated/scipy.stats.qmc.Sobol.html for further information.

Source code in smac/initial_design/sobol_design.py
def __init__(self, *args: Any, **kwargs: Any) -> None:
    super().__init__(*args, **kwargs)

    if len(list(self._configspace.values())) > 21201:
        raise ValueError(
            "The default initial design Sobol sequence can only handle up to 21201 dimensions. "
            "Please use a different initial design, such as the Latin Hypercube design."
        )

meta property #

meta: dict[str, Any]

Returns the meta data of the created object.

select_configurations #

select_configurations() -> list[Configuration]

Selects the initial configurations. Internally, _select_configurations is called, which has to be implemented by the child class.

Returns#

configs : list[Configuration] Configurations from the child class.

Source code in smac/initial_design/abstract_initial_design.py
def select_configurations(self) -> list[Configuration]:
    """Selects the initial configurations. Internally, `_select_configurations` is called,
    which has to be implemented by the child class.

    Returns
    -------
    configs : list[Configuration]
        Configurations from the child class.
    """
    configs: list[Configuration] = []

    if self._n_configs == 0:
        logger.info("No initial configurations are used.")
    else:
        configs += self._select_configurations()

    # Adding additional configs
    configs += self._additional_configs

    for config in configs:
        if config.origin is None:
            config.origin = "Initial design"

    # Removing duplicates
    # (Reference: https://stackoverflow.com/questions/7961363/removing-duplicates-in-lists)
    configs = list(OrderedDict.fromkeys(configs))
    logger.info(
        f"Using {len(configs) - len(self._additional_configs)} initial design configurations "
        f"and {len(self._additional_configs)} additional configurations."
    )

    return configs