mirror of
https://github.com/microsoft/autogen.git
synced 2026-02-17 01:31:26 -05:00
use_best_model for catboost (#679)
* use_best_model for catboost * bump version to 1.0.11
This commit is contained in:
@@ -98,8 +98,8 @@ class TestRegression(unittest.TestCase):
|
||||
y_train = np.random.uniform(size=300)
|
||||
X_val = scipy.sparse.random(100, 900, density=0.0001)
|
||||
y_val = np.random.uniform(size=100)
|
||||
automl_experiment = AutoML()
|
||||
automl_settings = {
|
||||
automl = AutoML()
|
||||
settings = {
|
||||
"time_budget": 2,
|
||||
"metric": "mae",
|
||||
"task": "regression",
|
||||
@@ -110,23 +110,34 @@ class TestRegression(unittest.TestCase):
|
||||
"verbose": 0,
|
||||
"early_stop": True,
|
||||
}
|
||||
automl_experiment.fit(
|
||||
X_train=X_train,
|
||||
y_train=y_train,
|
||||
X_val=X_val,
|
||||
y_val=y_val,
|
||||
**automl_settings
|
||||
automl.fit(
|
||||
X_train=X_train, y_train=y_train, X_val=X_val, y_val=y_val, **settings
|
||||
)
|
||||
assert automl._state.X_val.shape == X_val.shape
|
||||
print(automl.predict(X_train))
|
||||
print(automl.model)
|
||||
print(automl.config_history)
|
||||
print(automl.best_model_for_estimator("rf"))
|
||||
print(automl.best_iteration)
|
||||
print(automl.best_estimator)
|
||||
print(automl.best_config)
|
||||
print(automl.best_loss)
|
||||
print(automl.best_config_train_time)
|
||||
|
||||
settings.update(
|
||||
{
|
||||
"estimator_list": ["catboost"],
|
||||
"keep_search_state": False,
|
||||
"model_history": False,
|
||||
"use_best_model": False,
|
||||
"time_budget": None,
|
||||
"max_iter": 2,
|
||||
"custom_hp": {"catboost": {"n_estimators": {"domain": 100}}},
|
||||
}
|
||||
)
|
||||
automl.fit(
|
||||
X_train=X_train, y_train=y_train, X_val=X_val, y_val=y_val, **settings
|
||||
)
|
||||
assert automl_experiment._state.X_val.shape == X_val.shape
|
||||
print(automl_experiment.predict(X_train))
|
||||
print(automl_experiment.model)
|
||||
print(automl_experiment.config_history)
|
||||
print(automl_experiment.best_model_for_estimator("rf"))
|
||||
print(automl_experiment.best_iteration)
|
||||
print(automl_experiment.best_estimator)
|
||||
print(automl_experiment.best_config)
|
||||
print(automl_experiment.best_loss)
|
||||
print(automl_experiment.best_config_train_time)
|
||||
|
||||
def test_parallel(self, hpo_method=None):
|
||||
automl_experiment = AutoML()
|
||||
|
||||
Reference in New Issue
Block a user