Skip to content
Open
Show file tree
Hide file tree
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
15 changes: 9 additions & 6 deletions flaml/tune/searcher/flow2.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,10 +746,13 @@ def reach(self, other: Searcher) -> bool:
# unordered cat choice is hard to reach by chance
if config1[key] != config2.get(key):
return False
delta = np.array(
[
incumbent1[key] - incumbent2.get(key, np.inf)
for key in self._tunable_keys
]
)
try:
delta = np.array(
[
incumbent1[key] - incumbent2.get(key, np.inf)
for key in self._tunable_keys
]
)
except TypeError:
return False
return np.linalg.norm(delta) <= self.step
8 changes: 8 additions & 0 deletions test/automl/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,14 @@ def test_sparse_matrix_lr(self):
print(automl_experiment.best_iteration)
print(automl_experiment.best_estimator)

def test_reach(self):
search_space = {
"params": tune.choice(
[{"param": "None"}, {"param": tune.qrandint(10, 100, 10)}]
),
}
return search_space
Comment on lines +411 to +417
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only creates a search space. It won't trigger the exception.
Please make sure your test triggers the exception by testing it locally.



if __name__ == "__main__":
test = TestClassification()
Expand Down