Merge branch 'microsoft:main' into main

This commit is contained in:
zsk
2022-06-25 14:49:48 -04:00
committed by GitHub
2 changed files with 14 additions and 19 deletions

View File

@@ -1,14 +1,17 @@
repos:
- repo: https://github.com/psf/black
rev: stable
rev: 22.3.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
rev: v4.3.0
hooks:
- id: flake8
- id: check-added-large-files
- id: check-ast
- id: check-byte-order-marker

View File

@@ -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()