Skip to content

blackboxopt.optimizers.staged.configuration_sampler

RandomSearchSampler (StagedIterationConfigurationSampler)

Source code in blackboxopt/optimizers/staged/configuration_sampler.py
class RandomSearchSampler(StagedIterationConfigurationSampler):
    def __init__(self, search_space: ParameterSpace):
        self.search_space = search_space

    def sample_configuration(self) -> Tuple[dict, dict]:
        return self.search_space.sample(), {}

    def digest_evaluation(self, evaluation: Evaluation):
        """Random Search is stateless and does nothing with finished evaluations."""

digest_evaluation(self, evaluation)

Random Search is stateless and does nothing with finished evaluations.

Source code in blackboxopt/optimizers/staged/configuration_sampler.py
def digest_evaluation(self, evaluation: Evaluation):
    """Random Search is stateless and does nothing with finished evaluations."""

sample_configuration(self)

Pick the next configuration.

Returns:

Type Description
Tuple[dict, dict]

The configuration to be evaluated, Additional information that will be added to the optimizer_info dict.

Source code in blackboxopt/optimizers/staged/configuration_sampler.py
def sample_configuration(self) -> Tuple[dict, dict]:
    return self.search_space.sample(), {}