A programming framework for agentic AI
support latest xgboost version (#599)
Chi Wangc45741a67b0a
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.ymlindex 19f3a3f40..8b1b2ce6a 100644--- a/.github/workflows/python-package.yml+++ b/.github/workflows/python-package.yml@@ -16,7 +16,7 @@ jobs:strategy:matrix:os: [ubuntu-latest, macos-latest, windows-2019]- python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]+ python-version: ["3.7", "3.8", "3.9", "3.10"]steps:- uses: actions/checkout@v2diff --git a/README.md b/README.mdindex f8397286f..5149e23d0 100644--- a/README.md+++ b/README.md@@ -1,7 +1,7 @@[](https://badge.fury.io/py/FLAML)[](https://github.com/microsoft/FLAML/actions/workflows/python-package.yml)-+[](https://pepy.tech/project/flaml)[](https://gitter.im/FLAMLer/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)@@ -27,7 +27,7 @@ FLAML has a .NET implementation as well from [ML.NET Model Builder](https://dotn## Installation-FLAML requires **Python version >= 3.6**. It can be installed from pip:+FLAML requires **Python version >= 3.7**. It can be installed from pip:```bashpip install flamldiff --git a/flaml/ml.py b/flaml/ml.pyindex 8e5e2df6d..75d67f4be 100644--- a/flaml/ml.py+++ b/flaml/ml.py@@ -1,5 +1,5 @@# !-# * Copyright (c) Microsoft Corporation. All rights reserved.+# * Copyright (c) FLAML authors. All rights reserved.# * Licensed under the MIT License. See LICENSE file in the# * project root for license information.import time@@ -39,7 +39,7 @@ from .model import (TransformersEstimator,TransformersEstimatorModelSelection,)-from .data import CLASSIFICATION, group_counts, TS_FORECAST, TS_VALUE_COL+from .data import CLASSIFICATION, group_counts, TS_FORECASTimport logginglogger = logging.getLogger(__name__)diff --git a/flaml/model.py b/flaml/model.pyindex 0bf7669db..f73187898 100644--- a/flaml/model.py+++ b/flaml/model.py@@ -155,7 +155,8 @@ class BaseEstimator:X_train = self._preprocess(X_train)model = self.estimator_class(**self.params)if logger.level == logging.DEBUG:- logger.debug(f"flaml.model - {model} fit started")+ # xgboost 1.6 doesn't display all the params in the model str+ logger.debug(f"flaml.model - {model} fit started with params {self.params}")model.fit(X_train, y_train, **kwargs)if logger.level == logging.DEBUG:logger.debug(f"flaml.model - {model} fit finished")@@ -1111,12 +1112,23 @@ class LGBMEstimator(BaseEstimator):kwargs.pop("callbacks")else:callbacks = self._callbacks(start_time, deadline)+ if isinstance(self, XGBoostSklearnEstimator):+ from xgboost import __version__++ if __version__ >= "1.6.0":+ # since xgboost>=1.6.0, callbacks can't be passed in fit()+ self.params["callbacks"] = callbacks+ callbacks = Noneself._fit(X_train,y_train,callbacks=callbacks,**kwargs,)+ if callbacks is None:+ # for xgboost>=1.6.0, pop callbacks to enable pickle+ callbacks = self.params.pop("callbacks")+ self._model.set_params(callbacks=callbacks[:-1])best_iteration = (self._model.get_booster().best_iterationif isinstance(self, XGBoostSklearnEstimator)@@ -1233,7 +1245,9 @@ class XGBoostEstimator(SKLearnEstimator):start_time = time.time()deadline = start_time + budget if budget else np.infif issparse(X_train):- self.params["tree_method"] = "auto"+ if xgb.__version__ < "1.6.0":+ # "auto" fails for sparse input since xgboost 1.6.0+ self.params["tree_method"] = "auto"else:X_train = self._preprocess(X_train)if "sample_weight" in kwargs:@@ -1337,9 +1351,11 @@ class XGBoostSklearnEstimator(SKLearnEstimator, LGBMEstimator):self.estimator_class = xgb.XGBRankerelif task in CLASSIFICATION:self.estimator_class = xgb.XGBClassifier+ self._xgb_version = xgb.__version__def fit(self, X_train, y_train, budget=None, **kwargs):- if issparse(X_train):+ if issparse(X_train) and self._xgb_version < "1.6.0":+ # "auto" fails for sparse input since xgboost 1.6.0self.params["tree_method"] = "auto"if kwargs.get("gpu_per_trial"):self.params["tree_method"] = "gpu_hist"diff --git a/flaml/version.py b/flaml/version.pyindex 9e604c040..e13bd590c 100644--- a/flaml/version.py+++ b/flaml/version.py@@ -1 +1 @@-__version__ = "1.0.7"+__version__ = "1.0.8"diff --git a/notebook/automl_classification.ipynb b/notebook/automl_classification.ipynbindex bd7eb89c9..fc145cf67 100644--- a/notebook/automl_classification.ipynb+++ b/notebook/automl_classification.ipynb@@ -26,7 +26,7 @@"\n","In this notebook, we use one real data example (binary classification) to showcase how to use FLAML library.\n","\n",- "FLAML requires `Python>=3.6`. To run this notebook example, please install flaml with the `notebook` option:\n",+ "FLAML requires `Python>=3.7`. To run this notebook example, please install flaml with the `notebook` option:\n","```bash\n","pip install flaml[notebook]\n","```"diff --git a/notebook/automl_lightgbm.ipynb b/notebook/automl_lightgbm.ipynbindex 29ab0c9f3..c043a6778 100644--- a/notebook/automl_lightgbm.ipynb+++ b/notebook/automl_lightgbm.ipynb@@ -27,7 +27,7 @@"\n","In this notebook, we demonstrate how to use FLAML library to tune hyperparameters of LightGBM with a regression example.\n","\n",- "FLAML requires `Python>=3.6`. To run this notebook example, please install flaml with the `notebook` option:\n",+ "FLAML requires `Python>=3.7`. To run this notebook example, please install flaml with the `notebook` option:\n","```bash\n","pip install flaml[notebook]\n","```"diff --git a/notebook/automl_nlp.ipynb b/notebook/automl_nlp.ipynbindex 19aef0565..0076de3ce 100644--- a/notebook/automl_nlp.ipynb+++ b/notebook/automl_nlp.ipynb@@ -26,7 +26,7 @@"\n","In this notebook, we demonstrate how to use the FLAML library to fine tune an NLP language model with hyperparameter search. We have tested this notebook on a server with 4 NVidia V100 GPU (32GB) and 400GB CPU Ram.\n","\n",- "FLAML requires `Python>=3.6`. To run this notebook example, please install flaml with the `nlp,ray,notebook` and `blendsearch` option:\n",+ "FLAML requires `Python>=3.7`. To run this notebook example, please install flaml with the `nlp,ray,notebook` and `blendsearch` option:\n","```bash\n","pip install flaml[nlp,ray,notebook,blendsearch];\n","```"diff --git a/notebook/automl_time_series_forecast.ipynb b/notebook/automl_time_series_forecast.ipynbindex ccb9bc2c3..81ba9e536 100644--- a/notebook/automl_time_series_forecast.ipynb+++ b/notebook/automl_time_series_forecast.ipynb@@ -21,7 +21,7 @@"\n","In this notebook, we demonstrate how to use FLAML library for time series forecasting tasks: univariate time series forecasting (only time), multivariate time series forecasting (with exogneous variables) and forecasting discrete values.\n","\n",- "FLAML requires Python>=3.6. To run this notebook example, please install flaml with the notebook and forecast option:\n"+ "FLAML requires Python>=3.7. To run this notebook example, please install flaml with the notebook and forecast option:\n"]},{diff --git a/notebook/automl_xgboost.ipynb b/notebook/automl_xgboost.ipynbindex 7cabe86bc..8e6697de7 100644--- a/notebook/automl_xgboost.ipynb+++ b/notebook/automl_xgboost.ipynb@@ -27,7 +27,7 @@"\n","In this notebook, we demonstrate how to use FLAML library to tune hyperparameters of XGBoost with a regression example.\n","\n",- "FLAML requires `Python>=3.6`. To run this notebook example, please install flaml with the `notebook` option:\n",+ "FLAML requires `Python>=3.7`. To run this notebook example, please install flaml with the `notebook` option:\n","```bash\n","pip install flaml[notebook]\n","```"diff --git a/notebook/autovw.ipynb b/notebook/autovw.ipynbindex 43f359c1e..5ee95d9d4 100644--- a/notebook/autovw.ipynb+++ b/notebook/autovw.ipynb@@ -8,7 +8,7 @@}},"source": [- "Copyright (c) 2020-2021 Microsoft Corporation. All rights reserved. \n",+ "Copyright (c) Microsoft Corporation. All rights reserved. \n","\n","Licensed under the MIT License.\n","\n",@@ -22,7 +22,7 @@"\n","*ChaCha for online AutoML. Qingyun Wu, Chi Wang, John Langford, Paul Mineiro and Marco Rossi. To appear in ICML 2021.*\n","\n",- "AutoVW is implemented in FLAML. FLAML requires `Python>=3.6`. To run this notebook example, please install:"+ "AutoVW is implemented in FLAML. FLAML requires `Python>=3.7`. To run this notebook example, please install:"]},{diff --git a/notebook/integrate_azureml.ipynb b/notebook/integrate_azureml.ipynbindex 938fbb8d2..da4bcafe5 100644--- a/notebook/integrate_azureml.ipynb+++ b/notebook/integrate_azureml.ipynb@@ -8,7 +8,7 @@}},"source": [- "Copyright (c) 2020-2021 Microsoft Corporation. All rights reserved. \n",+ "Copyright (c) Microsoft Corporation. All rights reserved. \n","\n","Licensed under the MIT License.\n","\n",@@ -27,7 +27,7 @@"\n","In this notebook, we use one real data example (binary classification) to showcase how to use FLAML library together with AzureML.\n","\n",- "FLAML requires `Python>=3.6`. To run this notebook example, please install flaml with the [azureml] option:\n",+ "FLAML requires `Python>=3.7`. To run this notebook example, please install flaml with the [azureml] option:\n","```bash\n","pip install flaml[azureml]\n","```"diff --git a/notebook/integrate_sklearn.ipynb b/notebook/integrate_sklearn.ipynbindex 0d85bb083..4f0e0b98f 100644--- a/notebook/integrate_sklearn.ipynb+++ b/notebook/integrate_sklearn.ipynb@@ -39,7 +39,7 @@"\n","In this notebook, we use one real data example (binary classification) to showcase how to use FLAML library.\n","\n",- "FLAML requires `Python>=3.6`. To run this notebook example, please install flaml with the `notebook` option:\n",+ "FLAML requires `Python>=3.7`. To run this notebook example, please install flaml with the `notebook` option:\n","```bash\n","pip install flaml[notebook]\n","```"diff --git a/notebook/research/acl2021.ipynb b/notebook/research/acl2021.ipynbindex d8ad5b94a..d1374eba5 100644--- a/notebook/research/acl2021.ipynb+++ b/notebook/research/acl2021.ipynb@@ -4,7 +4,7 @@"cell_type": "markdown","metadata": {},"source": [- "Copyright (c) 2020-2021. All rights reserved.\n",+ "Copyright (c). All rights reserved.\n","\n","Licensed under the MIT License.\n","\n",@@ -22,7 +22,7 @@"\n","*Running this notebook takes about one hour.\n","\n",- "FLAML requires `Python>=3.6`. To run this notebook example, please install flaml with the `notebook` and `nlp` options:\n",+ "FLAML requires `Python>=3.7`. To run this notebook example, please install flaml with the `notebook` and `nlp` options:\n","\n","```bash\n","pip install flaml[nlp]==0.7.1 # in higher version of flaml, the API for nlp tasks changed\n",@@ -364,10 +364,10 @@"name": "stdout","output_type": "stream","text": [- "\u001B[2m\u001B[36m(pid=50964)\u001B[0m {'eval_loss': 0.5942569971084595, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10434782608695652}\n",- "\u001B[2m\u001B[36m(pid=50964)\u001B[0m {'eval_loss': 0.5942569971084595, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10434782608695652}\n",- "\u001B[2m\u001B[36m(pid=50948)\u001B[0m {'eval_loss': 0.649192214012146, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.2}\n",- "\u001B[2m\u001B[36m(pid=50948)\u001B[0m {'eval_loss': 0.649192214012146, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.2}\n"+ "\u001b[2m\u001b[36m(pid=50964)\u001b[0m {'eval_loss': 0.5942569971084595, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10434782608695652}\n",+ "\u001b[2m\u001b[36m(pid=50964)\u001b[0m {'eval_loss': 0.5942569971084595, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10434782608695652}\n",+ "\u001b[2m\u001b[36m(pid=50948)\u001b[0m {'eval_loss': 0.649192214012146, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.2}\n",+ "\u001b[2m\u001b[36m(pid=50948)\u001b[0m {'eval_loss': 0.649192214012146, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.2}\n"]},{@@ -485,12 +485,12 @@"name": "stdout","output_type": "stream","text": [- "\u001B[2m\u001B[36m(pid=54411)\u001B[0m {'eval_loss': 0.624100387096405, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=54411)\u001B[0m {'eval_loss': 0.624100387096405, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=54411)\u001B[0m {'eval_loss': 0.624100387096405, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=54417)\u001B[0m {'eval_loss': 0.5938675999641418, 'eval_accuracy': 0.7156862745098039, 'eval_f1': 0.8258258258258258, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=54417)\u001B[0m {'eval_loss': 0.5938675999641418, 'eval_accuracy': 0.7156862745098039, 'eval_f1': 0.8258258258258258, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=54417)\u001B[0m {'eval_loss': 0.5938675999641418, 'eval_accuracy': 0.7156862745098039, 'eval_f1': 0.8258258258258258, 'epoch': 0.5}\n"+ "\u001b[2m\u001b[36m(pid=54411)\u001b[0m {'eval_loss': 0.624100387096405, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=54411)\u001b[0m {'eval_loss': 0.624100387096405, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=54411)\u001b[0m {'eval_loss': 0.624100387096405, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=54417)\u001b[0m {'eval_loss': 0.5938675999641418, 'eval_accuracy': 0.7156862745098039, 'eval_f1': 0.8258258258258258, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=54417)\u001b[0m {'eval_loss': 0.5938675999641418, 'eval_accuracy': 0.7156862745098039, 'eval_f1': 0.8258258258258258, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=54417)\u001b[0m {'eval_loss': 0.5938675999641418, 'eval_accuracy': 0.7156862745098039, 'eval_f1': 0.8258258258258258, 'epoch': 0.5}\n"]},{@@ -590,18 +590,18 @@"name": "stdout","output_type": "stream","text": [- "\u001B[2m\u001B[36m(pid=57835)\u001B[0m {'eval_loss': 0.5822290778160095, 'eval_accuracy': 0.7058823529411765, 'eval_f1': 0.8181818181818181, 'epoch': 0.5043478260869565}\n",- "\u001B[2m\u001B[36m(pid=57835)\u001B[0m {'eval_loss': 0.5822290778160095, 'eval_accuracy': 0.7058823529411765, 'eval_f1': 0.8181818181818181, 'epoch': 0.5043478260869565}\n",- "\u001B[2m\u001B[36m(pid=57835)\u001B[0m {'eval_loss': 0.5822290778160095, 'eval_accuracy': 0.7058823529411765, 'eval_f1': 0.8181818181818181, 'epoch': 0.5043478260869565}\n",- "\u001B[2m\u001B[36m(pid=57835)\u001B[0m {'eval_loss': 0.5822290778160095, 'eval_accuracy': 0.7058823529411765, 'eval_f1': 0.8181818181818181, 'epoch': 0.5043478260869565}\n",- "\u001B[2m\u001B[36m(pid=57836)\u001B[0m {'eval_loss': 0.6087244749069214, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10344827586206896}\n",- "\u001B[2m\u001B[36m(pid=57836)\u001B[0m {'eval_loss': 0.6087244749069214, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10344827586206896}\n",- "\u001B[2m\u001B[36m(pid=57836)\u001B[0m {'eval_loss': 0.6087244749069214, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10344827586206896}\n",- "\u001B[2m\u001B[36m(pid=57836)\u001B[0m {'eval_loss': 0.6087244749069214, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10344827586206896}\n",- "\u001B[2m\u001B[36m(pid=57839)\u001B[0m {'eval_loss': 0.5486209392547607, 'eval_accuracy': 0.7034313725490197, 'eval_f1': 0.8141321044546851, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=57839)\u001B[0m {'eval_loss': 0.5486209392547607, 'eval_accuracy': 0.7034313725490197, 'eval_f1': 0.8141321044546851, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=57839)\u001B[0m {'eval_loss': 0.5486209392547607, 'eval_accuracy': 0.7034313725490197, 'eval_f1': 0.8141321044546851, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=57839)\u001B[0m {'eval_loss': 0.5486209392547607, 'eval_accuracy': 0.7034313725490197, 'eval_f1': 0.8141321044546851, 'epoch': 0.5}\n"+ "\u001b[2m\u001b[36m(pid=57835)\u001b[0m {'eval_loss': 0.5822290778160095, 'eval_accuracy': 0.7058823529411765, 'eval_f1': 0.8181818181818181, 'epoch': 0.5043478260869565}\n",+ "\u001b[2m\u001b[36m(pid=57835)\u001b[0m {'eval_loss': 0.5822290778160095, 'eval_accuracy': 0.7058823529411765, 'eval_f1': 0.8181818181818181, 'epoch': 0.5043478260869565}\n",+ "\u001b[2m\u001b[36m(pid=57835)\u001b[0m {'eval_loss': 0.5822290778160095, 'eval_accuracy': 0.7058823529411765, 'eval_f1': 0.8181818181818181, 'epoch': 0.5043478260869565}\n",+ "\u001b[2m\u001b[36m(pid=57835)\u001b[0m {'eval_loss': 0.5822290778160095, 'eval_accuracy': 0.7058823529411765, 'eval_f1': 0.8181818181818181, 'epoch': 0.5043478260869565}\n",+ "\u001b[2m\u001b[36m(pid=57836)\u001b[0m {'eval_loss': 0.6087244749069214, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10344827586206896}\n",+ "\u001b[2m\u001b[36m(pid=57836)\u001b[0m {'eval_loss': 0.6087244749069214, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10344827586206896}\n",+ "\u001b[2m\u001b[36m(pid=57836)\u001b[0m {'eval_loss': 0.6087244749069214, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10344827586206896}\n",+ "\u001b[2m\u001b[36m(pid=57836)\u001b[0m {'eval_loss': 0.6087244749069214, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.10344827586206896}\n",+ "\u001b[2m\u001b[36m(pid=57839)\u001b[0m {'eval_loss': 0.5486209392547607, 'eval_accuracy': 0.7034313725490197, 'eval_f1': 0.8141321044546851, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=57839)\u001b[0m {'eval_loss': 0.5486209392547607, 'eval_accuracy': 0.7034313725490197, 'eval_f1': 0.8141321044546851, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=57839)\u001b[0m {'eval_loss': 0.5486209392547607, 'eval_accuracy': 0.7034313725490197, 'eval_f1': 0.8141321044546851, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=57839)\u001b[0m {'eval_loss': 0.5486209392547607, 'eval_accuracy': 0.7034313725490197, 'eval_f1': 0.8141321044546851, 'epoch': 0.5}\n"]},{@@ -701,21 +701,21 @@"name": "stdout","output_type": "stream","text": [- "\u001B[2m\u001B[36m(pid=61251)\u001B[0m {'eval_loss': 0.6236899495124817, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=61251)\u001B[0m {'eval_loss': 0.6236899495124817, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=61251)\u001B[0m {'eval_loss': 0.6236899495124817, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=61251)\u001B[0m {'eval_loss': 0.6236899495124817, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=61251)\u001B[0m {'eval_loss': 0.6236899495124817, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",- "\u001B[2m\u001B[36m(pid=61255)\u001B[0m {'eval_loss': 0.6249027848243713, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.3}\n",- "\u001B[2m\u001B[36m(pid=61255)\u001B[0m {'eval_loss': 0.6249027848243713, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.3}\n",- "\u001B[2m\u001B[36m(pid=61255)\u001B[0m {'eval_loss': 0.6249027848243713, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.3}\n",- "\u001B[2m\u001B[36m(pid=61255)\u001B[0m {'eval_loss': 0.6249027848243713, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.3}\n",- "\u001B[2m\u001B[36m(pid=61255)\u001B[0m {'eval_loss': 0.6249027848243713, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.3}\n",- "\u001B[2m\u001B[36m(pid=61236)\u001B[0m {'eval_loss': 0.6138392686843872, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.20689655172413793}\n",- "\u001B[2m\u001B[36m(pid=61236)\u001B[0m {'eval_loss': 0.6138392686843872, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.20689655172413793}\n",- "\u001B[2m\u001B[36m(pid=61236)\u001B[0m {'eval_loss': 0.6138392686843872, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.20689655172413793}\n",- "\u001B[2m\u001B[36m(pid=61236)\u001B[0m {'eval_loss': 0.6138392686843872, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.20689655172413793}\n",- "\u001B[2m\u001B[36m(pid=61236)\u001B[0m {'eval_loss': 0.6138392686843872, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.20689655172413793}\n"+ "\u001b[2m\u001b[36m(pid=61251)\u001b[0m {'eval_loss': 0.6236899495124817, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=61251)\u001b[0m {'eval_loss': 0.6236899495124817, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=61251)\u001b[0m {'eval_loss': 0.6236899495124817, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=61251)\u001b[0m {'eval_loss': 0.6236899495124817, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=61251)\u001b[0m {'eval_loss': 0.6236899495124817, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.5}\n",+ "\u001b[2m\u001b[36m(pid=61255)\u001b[0m {'eval_loss': 0.6249027848243713, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.3}\n",+ "\u001b[2m\u001b[36m(pid=61255)\u001b[0m {'eval_loss': 0.6249027848243713, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.3}\n",+ "\u001b[2m\u001b[36m(pid=61255)\u001b[0m {'eval_loss': 0.6249027848243713, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.3}\n",+ "\u001b[2m\u001b[36m(pid=61255)\u001b[0m {'eval_loss': 0.6249027848243713, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.3}\n",+ "\u001b[2m\u001b[36m(pid=61255)\u001b[0m {'eval_loss': 0.6249027848243713, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.3}\n",+ "\u001b[2m\u001b[36m(pid=61236)\u001b[0m {'eval_loss': 0.6138392686843872, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.20689655172413793}\n",+ "\u001b[2m\u001b[36m(pid=61236)\u001b[0m {'eval_loss': 0.6138392686843872, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.20689655172413793}\n",+ "\u001b[2m\u001b[36m(pid=61236)\u001b[0m {'eval_loss': 0.6138392686843872, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.20689655172413793}\n",+ "\u001b[2m\u001b[36m(pid=61236)\u001b[0m {'eval_loss': 0.6138392686843872, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.20689655172413793}\n",+ "\u001b[2m\u001b[36m(pid=61236)\u001b[0m {'eval_loss': 0.6138392686843872, 'eval_accuracy': 0.6838235294117647, 'eval_f1': 0.8122270742358079, 'epoch': 0.20689655172413793}\n"]},{@@ -806,4 +806,4 @@},"nbformat": 4,"nbformat_minor": 1-}\ No newline at end of file+}diff --git a/notebook/zeroshot_lightgbm.ipynb b/notebook/zeroshot_lightgbm.ipynbindex 783f03700..c5cb63783 100644--- a/notebook/zeroshot_lightgbm.ipynb+++ b/notebook/zeroshot_lightgbm.ipynb@@ -19,7 +19,7 @@"\n","In this notebook, we demonstrate a basic use case of zero-shot AutoML with FLAML.\n","\n",- "FLAML requires `Python>=3.6`. To run this notebook example, please install flaml and openml:"+ "FLAML requires `Python>=3.7`. To run this notebook example, please install flaml and openml:"]},{diff --git a/setup.py b/setup.pyindex 0a1ee4371..de126ca07 100644--- a/setup.py+++ b/setup.py@@ -16,7 +16,7 @@ __version__ = version["__version__"]install_requires = ["NumPy>=1.17.0rc1","lightgbm>=2.3.1",- "xgboost>=0.90,<=1.3.3",+ "xgboost>=0.90","scipy>=1.4.1","pandas>=1.1.4","scikit-learn>=0.24",@@ -110,5 +110,5 @@ setuptools.setup("License :: OSI Approved :: MIT License","Operating System :: OS Independent",],- python_requires=">=3.6",+ python_requires=">=3.7",)diff --git a/test/automl/test_classification.py b/test/automl/test_classification.pyindex 6eac50a57..e7b5e6345 100644--- a/test/automl/test_classification.py+++ b/test/automl/test_classification.py@@ -87,10 +87,10 @@ class TestClassification(unittest.TestCase):automl = AutoML()automl_settings = {- "time_budget": 6,+ "time_budget": 3,"task": "classification","n_jobs": 1,- "estimator_list": ["catboost", "lrl2"],+ "estimator_list": ["xgboost", "catboost", "kneighbor"],"eval_method": "cv","n_splits": 3,"metric": "accuracy",@@ -99,43 +99,46 @@ class TestClassification(unittest.TestCase):"ensemble": True,}automl.fit(X, y, **automl_settings)+ del automlautoml = AutoML()- try:- import ray-- n_concurrent_trials = 2- except ImportError:- n_concurrent_trials = 1automl_settings = {- "time_budget": 2,+ "time_budget": 6,"task": "classification","n_jobs": 1,- "estimator_list": ["lrl2", "kneighbor"],+ "estimator_list": ["catboost", "lrl2"],"eval_method": "cv","n_splits": 3,"metric": "accuracy","log_training_metric": True,- "verbose": 4,+ # "verbose": 4,"ensemble": True,- "n_concurrent_trials": n_concurrent_trials,}automl.fit(X, y, **automl_settings)+ del automlautoml = AutoML()+ try:+ import ray++ n_concurrent_trials = 2+ except ImportError:+ n_concurrent_trials = 1automl_settings = {- "time_budget": 3,+ "time_budget": 2,"task": "classification","n_jobs": 1,- "estimator_list": ["xgboost", "catboost", "kneighbor"],+ "estimator_list": ["lrl2", "kneighbor"],"eval_method": "cv","n_splits": 3,"metric": "accuracy","log_training_metric": True,- # "verbose": 4,+ "verbose": 4,"ensemble": True,+ "n_concurrent_trials": n_concurrent_trials,}automl.fit(X, y, **automl_settings)+ del automlautoml = AutoML()automl_settings = {@@ -151,6 +154,7 @@ class TestClassification(unittest.TestCase):"ensemble": True,}automl.fit(X, y, **automl_settings)+ del automldef test_binary(self):automl_experiment = AutoML()@@ -208,7 +212,7 @@ class TestClassification(unittest.TestCase):_ = automl_experiment.predict(fake_df)def test_sparse_matrix_xgboost(self):- automl_experiment = AutoML()+ automl = AutoML()automl_settings = {"time_budget": 3,"metric": "ap",@@ -223,15 +227,28 @@ class TestClassification(unittest.TestCase):import xgboost as xgbcallback = xgb.callback.TrainingCallback()- automl_experiment.fit(+ automl.fit(X_train=X_train, y_train=y_train, callbacks=[callback], **automl_settings)- print(automl_experiment.predict(X_train))- print(automl_experiment.model)- print(automl_experiment.config_history)- print(automl_experiment.best_model_for_estimator("xgboost"))- print(automl_experiment.best_iteration)- print(automl_experiment.best_estimator)+ print(automl.predict(X_train))+ print(automl.model)+ print(automl.config_history)+ print(automl.best_model_for_estimator("xgboost"))+ print(automl.best_iteration)+ print(automl.best_estimator)++ # test an old version of xgboost+ import subprocess+ import sys++ subprocess.check_call(+ [sys.executable, "-m", "pip", "install", "xgboost==1.3.3", "--user"]+ )+ automl = AutoML()+ automl.fit(X_train=X_train, y_train=y_train, **automl_settings)+ subprocess.check_call(+ [sys.executable, "-m", "pip", "install", "-U", "xgboost", "--user"]+ )def test_ray_classification(self):X, y = load_breast_cancer(return_X_y=True)@@ -353,5 +370,5 @@ class TestClassification(unittest.TestCase):if __name__ == "__main__":- unittest.main()test = TestClassification()+ test.test_preprocess()diff --git a/test/tune/test_reproducibility.py b/test/tune/test_reproducibility.pyindex 8a0b6230a..c0229b8cf 100644--- a/test/tune/test_reproducibility.py+++ b/test/tune/test_reproducibility.py@@ -24,9 +24,7 @@ def _easy_objective(use_raytune, config):return-def test_tune(- smoke_test=True, externally_setup_searcher=False, use_ray=False, use_raytune=False-):+def test_tune(externally_setup_searcher=False, use_ray=False, use_raytune=False):from flaml import tunefrom flaml.searcher.blendsearch import BlendSearch@@ -95,7 +93,7 @@ def test_tune(metric="mean_loss",mode="min",num_samples=10,- time_budget_s=5,+ # time_budget_s=5,use_ray=use_ray,config=search_space,)@@ -107,14 +105,14 @@ def test_tune(def test_reproducibility():- best_config_1 = test_tune(smoke_test=True)- best_config_2 = test_tune(smoke_test=True)+ best_config_1 = test_tune()+ best_config_2 = test_tune()print(best_config_1)print(best_config_2)assert best_config_1 == best_config_2, "flaml.tune not reproducible"- best_config_1 = test_tune(smoke_test=True, externally_setup_searcher=True)- best_config_2 = test_tune(smoke_test=True, externally_setup_searcher=True)+ best_config_1 = test_tune(externally_setup_searcher=True)+ best_config_2 = test_tune(externally_setup_searcher=True)print(best_config_1)print(best_config_2)assert (diff --git a/website/docs/Installation.md b/website/docs/Installation.mdindex bccdadd47..73aad1500 100644--- a/website/docs/Installation.md+++ b/website/docs/Installation.md@@ -1,6 +1,6 @@# Installation-FLAML requires **Python version >= 3.6**. It can be installed from pip:+FLAML requires **Python version >= 3.7**. It can be installed from pip:```bashpip install flaml