mirror of
https://github.com/microsoft/autogen.git
synced 2026-02-16 02:45:29 -05:00
init value type match (#575)
* init value type match * bump version to 1.0.6 * add a note about flaml version in notebook * add note about mismatched ITER_HP * catch SSLError when accessing OpenML data * catch errors in autovw test Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from openml.exceptions import OpenMLServerException
|
||||
from requests.exceptions import ChunkedEncodingError
|
||||
from requests.exceptions import ChunkedEncodingError, SSLError
|
||||
|
||||
|
||||
def test_automl(budget=5, dataset_format="dataframe", hpo_method=None):
|
||||
@@ -23,6 +23,7 @@ def test_automl(budget=5, dataset_format="dataframe", hpo_method=None):
|
||||
OpenMLServerException,
|
||||
ChunkedEncodingError,
|
||||
urllib3.exceptions.ReadTimeoutError,
|
||||
SSLError,
|
||||
) as e:
|
||||
print(e)
|
||||
return
|
||||
@@ -110,7 +111,7 @@ def test_mlflow():
|
||||
X_train, X_test, y_train, y_test = load_openml_task(
|
||||
task_id=7592, data_dir="test/"
|
||||
)
|
||||
except (OpenMLServerException, ChunkedEncodingError) as e:
|
||||
except (OpenMLServerException, ChunkedEncodingError, SSLError) as e:
|
||||
print(e)
|
||||
return
|
||||
""" import AutoML class from flaml package """
|
||||
|
||||
@@ -56,6 +56,7 @@ class TestRegression(unittest.TestCase):
|
||||
y_pred = automl.predict(X_train)
|
||||
print(y_pred)
|
||||
print(automl.model.estimator)
|
||||
n_iter = automl.model.estimator.get_params("n_estimators")
|
||||
print(automl.config_history)
|
||||
print(automl.best_model_for_estimator("xgboost"))
|
||||
print(automl.best_iteration)
|
||||
@@ -86,7 +87,11 @@ class TestRegression(unittest.TestCase):
|
||||
)
|
||||
print(automl.model.estimator)
|
||||
y_pred2 = automl.predict(X_train)
|
||||
assert (y_pred == y_pred2).all()
|
||||
# In some rare case, the last config is early stopped and it's the best config. But the logged config's n_estimator is not reduced.
|
||||
assert (
|
||||
n_iter != automl.model.estimator.get_params("n_estimator")
|
||||
or (y_pred == y_pred2).all()
|
||||
)
|
||||
|
||||
def test_sparse_matrix_regression(self):
|
||||
X_train = scipy.sparse.random(300, 900, density=0.0001)
|
||||
|
||||
@@ -12,6 +12,7 @@ from flaml import AutoVW
|
||||
import string
|
||||
import os
|
||||
import openml
|
||||
from requests.exceptions import SSLError
|
||||
|
||||
VW_DS_DIR = "test/data/"
|
||||
NS_LIST = list(string.ascii_lowercase) + list(string.ascii_uppercase)
|
||||
@@ -96,10 +97,14 @@ def shuffle_data(X, y, seed):
|
||||
def get_oml_to_vw(did, max_ns_num, ds_dir=VW_DS_DIR):
|
||||
success = False
|
||||
print("-----getting oml dataset-------", did)
|
||||
ds = openml.datasets.get_dataset(did)
|
||||
target_attribute = ds.default_target_attribute
|
||||
# if target_attribute is None and did in OML_target_attribute_dict:
|
||||
# target_attribute = OML_target_attribute_dict[did]
|
||||
try:
|
||||
ds = openml.datasets.get_dataset(did)
|
||||
target_attribute = ds.default_target_attribute
|
||||
# if target_attribute is None and did in OML_target_attribute_dict:
|
||||
# target_attribute = OML_target_attribute_dict[did]
|
||||
except (SSLError) as e:
|
||||
print(e)
|
||||
return
|
||||
|
||||
print("target=ds.default_target_attribute", target_attribute)
|
||||
data = ds.get_data(target=target_attribute, dataset_format="array")
|
||||
|
||||
Reference in New Issue
Block a user