2
2
# Flags: doc-Runnable
3
3
4
4
This examples show how to use the Ask-and-Tell interface.
5
+
6
+ Notice, that the ask-and-tell interface will still use the initial design specified in the facade.
7
+ Should you wish to add your own evaluated configurations instead or deactivate the initial
8
+ design all together, please refer to the warmstarting example in conjunction with this one.
5
9
"""
6
10
7
11
from ConfigSpace import Configuration , ConfigurationSpace , Float
@@ -52,7 +56,7 @@ def train(self, config: Configuration, seed: int = 0) -> float:
52
56
# Now we use SMAC to find the best hyperparameters
53
57
smac = HyperparameterOptimizationFacade (
54
58
scenario ,
55
- model .train ,
59
+ target_function = model .train ,
56
60
intensifier = intensifier ,
57
61
overwrite = True ,
58
62
)
@@ -68,7 +72,14 @@ def train(self, config: Configuration, seed: int = 0) -> float:
68
72
smac .tell (info , value )
69
73
70
74
# After calling ask+tell, we can still optimize
71
- # Note: SMAC will optimize the next 90 trials because 10 trials already have been evaluated
75
+ # Note: SMAC will optimize the next 90 trials because 10 trials already have been evaluated.
76
+ # If we however choose not to call optimize; e.g. because we want to manage heavy
77
+ # computation of model.train completely outside smac, but still use it to suggest new
78
+ # configurations, then n_trials will only be relevant for the initial design in combination
79
+ # with initial design max_ratio! In fact in an only ask+tell case, we could even set
80
+ # target_function=None in the constructor, because smac wouldn't even need to know
81
+ # what the target function is. But that will prevent us from calling optimize and validate later
82
+ # on.
72
83
incumbent = smac .optimize ()
73
84
74
85
# Get cost of default configuration
0 commit comments