Skip to content
Merged
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
2 changes: 1 addition & 1 deletion flaml/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.5.0"
__version__ = "2.6.0"
16 changes: 9 additions & 7 deletions test/automl/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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__":
Expand Down
8 changes: 5 additions & 3 deletions test/automl/test_score.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from urllib.error import URLError

import pandas as pd
from sklearn.datasets import fetch_california_housing, fetch_openml

Expand Down Expand Up @@ -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

Expand Down
26 changes: 14 additions & 12 deletions test/automl/test_split.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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 = {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions test/automl/test_xgboost2d.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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():
Expand Down
Loading