Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix storage API having SMAC as a required dependency #899

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import ConfigSpace
import numpy.typing as npt
import pandas as pd
from smac.utils.configspace import convert_configurations_to_array

from mlos_core.data_classes import Observation, Observations, Suggestion
from mlos_core.optimizers.bayesian_optimizers.bayesian_optimizer import (
Expand Down Expand Up @@ -121,6 +120,10 @@ def __init__(
from smac.main.config_selector import ConfigSelector
from smac.random_design.probability_design import ProbabilityRandomDesign
from smac.runhistory import TrialInfo
from smac.utils.configspace import convert_configurations_to_array

# Save util function here as a property for later usage, also to satisfy linter
eujing marked this conversation as resolved.
Show resolved Hide resolved
self._convert_configurations_to_array = convert_configurations_to_array

# Store for TrialInfo instances returned by .ask()
self.trial_info_map: Dict[ConfigSpace.Configuration, TrialInfo] = {}
Expand Down Expand Up @@ -411,7 +414,7 @@ def surrogate_predict(self, suggestion: Suggestion) -> npt.NDArray:
if self.base_optimizer._config_selector._model is None:
raise RuntimeError("Surrogate model is not yet trained")

config_array = convert_configurations_to_array(
config_array = self._convert_configurations_to_array(
[
ConfigSpace.Configuration(
self.optimizer_parameter_space, values=suggestion.config.to_dict()
Expand Down
Loading