@@ -108,7 +108,8 @@ def __init__(self,
108
108
all_supported_metrics : bool = True ,
109
109
ensemble_callback : typing .Optional [EnsembleBuilderManager ] = None ,
110
110
logger_port : typing .Optional [int ] = None ,
111
- search_space_updates : typing .Optional [HyperparameterSearchSpaceUpdates ] = None
111
+ search_space_updates : typing .Optional [HyperparameterSearchSpaceUpdates ] = None ,
112
+ run_greedy_portfolio : bool = False
112
113
):
113
114
"""
114
115
Interface to SMAC. This method calls the SMAC optimize method, and allows
@@ -157,7 +158,9 @@ def __init__(self,
157
158
Allows to create a user specified SMAC object
158
159
ensemble_callback (typing.Optional[EnsembleBuilderManager]):
159
160
A callback used in this scenario to start ensemble building subtasks
160
-
161
+ run_greedy_portfolio (bool), (default=False): If True,
162
+ runs initial configurations present in
163
+ 'autoPyTorch/optimizer/greedy_portfolio.json'.
161
164
"""
162
165
super (AutoMLSMBO , self ).__init__ ()
163
166
# data related
@@ -213,16 +216,18 @@ def __init__(self,
213
216
# read and validate initial configurations
214
217
initial_configurations = json .load (open (os .path .join (os .path .dirname (__file__ ), 'greedy_portfolio.json' )))
215
218
216
- self .initial_configurations : typing .List [Configuration ] = list ()
217
- for configuration_dict in initial_configurations :
218
- try :
219
- configuration = Configuration (self .config_space , configuration_dict )
220
- self .initial_configurations .append (configuration )
221
- except Exception as e :
222
- self .logger .warning (f"Failed to convert { configuration_dict } into"
223
- f" a Configuration with error { e } . "
224
- f"Therefore, it can't be used as an initial "
225
- f"configuration as it does not match the current config space. " )
219
+ self .initial_configurations : typing .Optional [typing .List [Configuration ]] = None
220
+ if run_greedy_portfolio :
221
+ self .initial_configurations = list ()
222
+ for configuration_dict in initial_configurations :
223
+ try :
224
+ configuration = Configuration (self .config_space , configuration_dict )
225
+ self .initial_configurations .append (configuration )
226
+ except Exception as e :
227
+ self .logger .warning (f"Failed to convert { configuration_dict } into"
228
+ f" a Configuration with error { e } . "
229
+ f"Therefore, it can't be used as an initial "
230
+ f"configuration as it does not match the current config space. " )
226
231
227
232
def reset_data_manager (self ) -> None :
228
233
if self .datamanager is not None :
0 commit comments