A programming framework for agentic AI
cath URLError
Chi Wang7d6822aa4088
diff --git a/test/automl/test_constraints.py b/test/automl/test_constraints.pyindex a47be3078..7555100d3 100644--- a/test/automl/test_constraints.py+++ b/test/automl/test_constraints.py@@ -1,11 +1,11 @@-import unittest-+from urllib.error import URLErrorfrom sklearn.datasets import fetch_openmlfrom sklearn.model_selection import train_test_split-from flaml.automl import AutoML+from sklearn.externals._arff import ArffException+from functools import partial+from flaml.automl import AutoML, sizefrom flaml import tune-dataset = "credit-g"@@ -24,11 +24,10 @@ def test_metric_constraints():"time_budget": 2,"pred_time_limit": 5.1e-05,}- from sklearn.externals._arff import ArffExceptiontry:X, y = fetch_openml(name=dataset, return_X_y=True)- except (ArffException, ValueError):+ except (ArffException, ValueError, URLError):from sklearn.datasets import load_wineX, y = load_wine(return_X_y=True)@@ -42,10 +41,6 @@ def test_metric_constraints():config = automl.best_config.copy()config["learner"] = automl.best_estimatorautoml.trainable(config)-- from flaml.automl import size- from functools import partial-print("metric constraints used in automl", automl.metric_constraints)analysis = tune.run(@@ -117,7 +112,6 @@ def test_metric_constraints_custom():("val_train_loss_gap", "<=", 0.05),],}- from sklearn.externals._arff import ArffExceptiontry:X, y = fetch_openml(name=dataset, return_X_y=True)@@ -151,11 +145,8 @@ def test_metric_constraints_custom():config = automl.best_config.copy()config["learner"] = automl.best_estimatorautoml.trainable(config)-- from flaml.automl import size- from functools import partial-print("metric constraints in automl", automl.metric_constraints)+analysis = tune.run(automl.trainable,automl.search_space,@@ -176,4 +167,5 @@ def test_metric_constraints_custom():if __name__ == "__main__":- unittest.main()+ test_metric_constraints()+ test_metric_constraints_custom()