A programming framework for agentic AI
check n_iter == 1
Chi Wangb2d8b097d78a
diff --git a/flaml/model.py b/flaml/model.pyindex 740515507..2deaa4ccf 100644--- a/flaml/model.py+++ b/flaml/model.py@@ -325,7 +325,7 @@ class LGBMEstimator(BaseEstimator):):self.params["n_estimators"] = 1self._t1 = self._fit(X_train, y_train, **kwargs)- if self._t1 >= budget:+ if self._t1 >= budget or n_iter == 1:# self.params["n_estimators"] = n_iterreturn self._t1self.params["n_estimators"] = min(n_iter, 4)@@ -742,7 +742,7 @@ class CatBoostEstimator(BaseEstimator):X_train, y_train, cat_features=cat_features, **kwargs)CatBoostEstimator._t1 = time.time() - start_time- if CatBoostEstimator._t1 >= budget:+ if CatBoostEstimator._t1 >= budget or n_iter == 1:# self.params["n_estimators"] = n_iterself._model = CatBoostEstimator._smallmodelshutil.rmtree(train_dir, ignore_errors=True)diff --git a/test/test_training_log.py b/test/test_training_log.pyindex 85ac91dc0..0ef0f577b 100644--- a/test/test_training_log.py+++ b/test/test_training_log.py@@ -37,10 +37,11 @@ class TestTrainingLog(unittest.TestCase):if automl.best_estimator:estimator, config = automl.best_estimator, automl.best_configmodel0 = automl.best_model_for_estimator(estimator)- print(model0.estimator)+ print(model0.params["n_estimators"], model0.estimator)automl.time_budget = Nonemodel, _ = automl._state._train_with_config(estimator, config)+ print(model.estimator)# model0 and model are equivalent unless model0's n_estimator is out of search space rangeassert (str(model0.estimator) == str(model.estimator)