From 768b9487fbea0b64beabbce458c370d322fa3f53 Mon Sep 17 00:00:00 2001 From: Li Jiang Date: Sat, 25 Apr 2026 20:30:41 +0800 Subject: [PATCH 1/2] Bump version to 2.6.0 --- flaml/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flaml/version.py b/flaml/version.py index 50062f87c0..e5e59e38da 100644 --- a/flaml/version.py +++ b/flaml/version.py @@ -1 +1 @@ -__version__ = "2.5.0" +__version__ = "2.6.0" From ce8bb7e326d505204d5b7660a83bdbd693033b3f Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 27 Apr 2026 13:57:43 +0800 Subject: [PATCH 2/2] Fix AutoML tests when OpenML redirects fail (#1537) * Handle OpenML redirect failures in tests Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/ef7e267b-7c76-41ae-bd4a-0a1b4ec5aefb Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com> * Guard empty metric constraint trials Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/ef7e267b-7c76-41ae-bd4a-0a1b4ec5aefb Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com> * Use robust synthetic fallback data Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/ef7e267b-7c76-41ae-bd4a-0a1b4ec5aefb Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com> --- test/automl/test_constraints.py | 16 +++++++++------- test/automl/test_score.py | 8 +++++--- test/automl/test_split.py | 26 ++++++++++++++------------ test/automl/test_xgboost2d.py | 10 ++++++---- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/test/automl/test_constraints.py b/test/automl/test_constraints.py index 836d7b6e72..9d2a288550 100644 --- a/test/automl/test_constraints.py +++ b/test/automl/test_constraints.py @@ -30,9 +30,9 @@ def test_metric_constraints(): try: X, y = fetch_openml(name=dataset, return_X_y=True) except (ArffException, ValueError, URLError): - from sklearn.datasets import load_wine + from sklearn.datasets import make_classification - X, y = load_wine(return_X_y=True) + X, y = make_classification(n_samples=1000, n_features=20, n_informative=10, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42) automl.fit(X_train=X_train, y_train=y_train, **automl_settings) print(automl.estimator_list) @@ -59,7 +59,8 @@ def test_metric_constraints(): metric_constraints=automl.metric_constraints, num_samples=5, ) - print(analysis.trials[-1]) + if analysis.trials: + print(analysis.trials[-1]) def custom_metric( @@ -116,10 +117,10 @@ def test_metric_constraints_custom(): try: X, y = fetch_openml(name=dataset, return_X_y=True) - except (ArffException, ValueError): - from sklearn.datasets import load_wine + except (ArffException, ValueError, URLError): + from sklearn.datasets import make_classification - X, y = load_wine(return_X_y=True) + X, y = make_classification(n_samples=1000, n_features=20, n_informative=10, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42) automl.fit(X_train=X_train, y_train=y_train, **automl_settings) print(automl.estimator_list) @@ -156,7 +157,8 @@ def test_metric_constraints_custom(): metric_constraints=automl.metric_constraints, num_samples=5, ) - print(analysis.trials[-1]) + if analysis.trials: + print(analysis.trials[-1]) if __name__ == "__main__": diff --git a/test/automl/test_score.py b/test/automl/test_score.py index 7e9abc864a..3187eb0557 100644 --- a/test/automl/test_score.py +++ b/test/automl/test_score.py @@ -1,3 +1,5 @@ +from urllib.error import URLError + import pandas as pd from sklearn.datasets import fetch_california_housing, fetch_openml @@ -181,10 +183,10 @@ def test_rank(self): try: X, y = fetch_openml(name=dataset, return_X_y=True) y = y.cat.codes - except (ArffException, ValueError): - from sklearn.datasets import load_wine + except (ArffException, ValueError, URLError): + from sklearn.datasets import make_classification - X, y = load_wine(return_X_y=True) + X, y = make_classification(n_samples=1000, n_features=20, n_informative=10, random_state=42) import numpy as np diff --git a/test/automl/test_split.py b/test/automl/test_split.py index c60e9c869d..7f5c365778 100644 --- a/test/automl/test_split.py +++ b/test/automl/test_split.py @@ -1,3 +1,5 @@ +from urllib.error import URLError + import numpy as np import pandas as pd from sklearn.datasets import fetch_openml, load_iris @@ -26,10 +28,10 @@ def _test(split_type): try: X, y = fetch_openml(name=dataset, return_X_y=True) - except (ArffException, ValueError): - from sklearn.datasets import load_wine + except (ArffException, ValueError, URLError): + from sklearn.datasets import make_classification - X, y = load_wine(return_X_y=True) + X, y = make_classification(n_samples=1000, n_features=20, n_informative=10, random_state=42) if split_type != "time": X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42) else: @@ -55,10 +57,10 @@ def test_groups_for_classification_task(): try: X, y = fetch_openml(name=dataset, return_X_y=True) - except (ArffException, ValueError): - from sklearn.datasets import load_wine + except (ArffException, ValueError, URLError): + from sklearn.datasets import make_classification - X, y = load_wine(return_X_y=True) + X, y = make_classification(n_samples=1000, n_features=20, n_informative=10, random_state=42) automl = AutoML() automl_settings = { @@ -193,10 +195,10 @@ def test_rank(): try: X, y = fetch_openml(name=dataset, return_X_y=True) y = y.cat.codes - except (ArffException, ValueError): - from sklearn.datasets import load_wine + except (ArffException, ValueError, URLError): + from sklearn.datasets import make_classification - X, y = load_wine(return_X_y=True) + X, y = make_classification(n_samples=1000, n_features=20, n_informative=10, random_state=42) import numpy as np automl = AutoML() @@ -230,10 +232,10 @@ def test_object(): try: X, y = fetch_openml(name=dataset, return_X_y=True) - except (ArffException, ValueError): - from sklearn.datasets import load_wine + except (ArffException, ValueError, URLError): + from sklearn.datasets import make_classification - X, y = load_wine(return_X_y=True) + X, y = make_classification(n_samples=1000, n_features=20, n_informative=10, random_state=42) import numpy as np diff --git a/test/automl/test_xgboost2d.py b/test/automl/test_xgboost2d.py index cd786e85c9..8d207411c4 100644 --- a/test/automl/test_xgboost2d.py +++ b/test/automl/test_xgboost2d.py @@ -1,4 +1,5 @@ import unittest +from urllib.error import URLError from sklearn.datasets import fetch_openml from sklearn.model_selection import train_test_split @@ -45,10 +46,10 @@ def test_simple(method=None): try: X, y = fetch_openml(name=dataset, return_X_y=True) - except (ArffException, ValueError): - from sklearn.datasets import load_wine + except (ArffException, ValueError, URLError): + from sklearn.datasets import make_classification - X, y = load_wine(return_X_y=True) + X, y = make_classification(n_samples=1000, n_features=20, n_informative=10, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42) automl.fit(X_train=X_train, y_train=y_train, **automl_settings) print(automl.estimator_list) @@ -80,7 +81,8 @@ def test_simple(method=None): metric_constraints=automl.metric_constraints, num_samples=5, ) - print(analysis.trials[-1]) + if analysis.trials: + print(analysis.trials[-1]) def test_optuna():