Skip to content

Commit 4b13ae1

Browse files
committed
In progress, adding flag in search function
1 parent ce6ed7a commit 4b13ae1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

autoPyTorch/api/tabular_classification.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def search(
131131
precision: int = 32,
132132
disable_file_output: List = [],
133133
load_models: bool = True,
134+
run_greedy_portfolio: bool = False
134135
) -> 'BaseTask':
135136
"""
136137
Search for the best pipeline configuration for the given dataset.
@@ -199,6 +200,8 @@ def search(
199200
disable_file_output (Union[bool, List]):
200201
load_models (bool), (default=True): Whether to load the
201202
models after fitting AutoPyTorch.
203+
run_greedy_portfolio (bool), (default=False): If True,
204+
runs initial
202205
203206
Returns:
204207
self

autoPyTorch/optimizer/smbo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import copy
22
import json
33
import logging.handlers
4+
import os
45
import typing
56

67
import ConfigSpace
@@ -210,8 +211,7 @@ def __init__(self,
210211
self.logger.info("initialised {}".format(self.__class__.__name__))
211212

212213
# read and validate initial configurations
213-
with open('greedy_portfolio.json', 'r') as fp:
214-
initial_configurations = json.load(fp)
214+
initial_configurations = json.load(open(os.path.join(os.path.dirname(__file__), 'greedy_portfolio.json')))
215215

216216
self.initial_configurations: typing.List[Configuration] = list()
217217
for configuration_dict in initial_configurations:
@@ -220,7 +220,7 @@ def __init__(self,
220220
self.initial_configurations.append(configuration)
221221
except Exception as e:
222222
self.logger.warning(f"Failed to convert {configuration_dict} into"
223-
f" a Configuration with error {e.msg[0]}. "
223+
f" a Configuration with error {e}. "
224224
f"Therefore, it can't be used as an initial "
225225
f"configuration as it does not match the current config space. ")
226226

0 commit comments

Comments
 (0)