mirror of
https://github.com/microsoft/autogen.git
synced 2025-11-03 03:10:04 +00:00
cath URLError
This commit is contained in:
parent
127e482ac8
commit
7d6822aa40
@ -1,11 +1,11 @@
|
||||
import unittest
|
||||
|
||||
from urllib.error import URLError
|
||||
from sklearn.datasets import fetch_openml
|
||||
from 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, size
|
||||
from 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 ArffException
|
||||
|
||||
try:
|
||||
X, y = fetch_openml(name=dataset, return_X_y=True)
|
||||
except (ArffException, ValueError):
|
||||
except (ArffException, ValueError, URLError):
|
||||
from sklearn.datasets import load_wine
|
||||
|
||||
X, y = load_wine(return_X_y=True)
|
||||
@ -42,10 +41,6 @@ def test_metric_constraints():
|
||||
config = automl.best_config.copy()
|
||||
config["learner"] = automl.best_estimator
|
||||
automl.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 ArffException
|
||||
|
||||
try:
|
||||
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_estimator
|
||||
automl.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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user