diff --git a/README.md b/README.md index e2c46ca287..2f6bf65387 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ English · 简体中文

-:fire: FLAML supports AutoML and Hyperparameter Tuning in [Microsoft Fabric Data Science](https://learn.microsoft.com/en-us/fabric/data-science/automated-machine-learning-fabric). In addition, we've introduced Python 3.11+ support, along with a range of new estimators, and comprehensive integration with MLflow—thanks to contributions from the Microsoft Fabric product team. +:fire: **FLAML 3.0** brings previously Fabric-only features into the public library: tunable feature engineering (AutoFE), exportable scikit-learn pipelines, expanded MLflow integration, and interactive visualization. Public Python and [Microsoft Fabric Data Science](https://learn.microsoft.com/en-us/fabric/data-science/automated-machine-learning-fabric) now share one implementation. Python 3.10–3.14 is supported, with Spark 4.2/4.3 covered on Python 3.14. See [what's new and how to get started](https://microsoft.github.io/FLAML/docs/Use-Cases/Fabric-Integration). :fire: Heads-up: [AutoGen](https://microsoft.github.io/autogen/) has moved to a dedicated [GitHub repository](https://github.com/microsoft/autogen). FLAML no longer includes the `autogen` module—please use AutoGen directly. @@ -53,6 +53,12 @@ pip install "flaml[automl]" Find more options in [Installation](https://microsoft.github.io/FLAML/docs/Installation). Each of the [`notebook examples`](https://github.com/microsoft/FLAML/tree/main/notebook) may require a specific option to be installed. +For the newly open-sourced features, use `pip install "flaml[autofe]"` for AutoFE, +or `pip install "flaml[fabric_python]"` for AutoFE, MLflow, and visualization +without Spark. AutoFE is opt-in; ordinary `flaml[automl]` installations still +do not require MLflow, Spark, or Fabric services. Existing users should review +the [3.0 upgrade notes](https://microsoft.github.io/FLAML/docs/Installation#upgrading-from-280-to-30). + ## Quickstart - With three lines of code, you can start using this economical and fast diff --git a/README.zh.md b/README.zh.md index bc6206755e..3c50eda11d 100644 --- a/README.zh.md +++ b/README.zh.md @@ -18,7 +18,7 @@ English · 简体中文

-:fire: FLAML 全面支持 [Microsoft Fabric Data Science](https://learn.microsoft.com/zh-cn/fabric/data-science/automated-machine-learning-fabric) 中的 AutoML 与超参数调优。此外,得益于 Microsoft Fabric 产品团队的贡献,我们引入了对 Python 3.11+ 的支持、一系列全新的算法评估器(Estimators),并深度集成了 MLflow。 +:fire: **FLAML 3.0** 将此前仅在 Fabric 中提供的功能引入公共库:可调优的自动特征工程(AutoFE)、可导出的 scikit-learn 流水线、更完整的 MLflow 集成和交互式可视化。公共 Python 环境与 [Microsoft Fabric Data Science](https://learn.microsoft.com/zh-cn/fabric/data-science/automated-machine-learning-fabric) 现已使用同一份实现。支持 Python 3.10–3.14,并在 Python 3.14 上测试 Spark 4.2/4.3。请参阅[新功能与入门指南(英文)](https://microsoft.github.io/FLAML/docs/Use-Cases/Fabric-Integration)。 :fire: **重要提醒**:[AutoGen](https://microsoft.github.io/autogen/) 已迁移至专属的[独立 GitHub 仓库](https://github.com/microsoft/autogen)。FLAML 代码库中已不再内置 `autogen` 模块——请直接使用 AutoGen 独立包。 @@ -36,7 +36,7 @@ FLAML 凝聚了微软研究院(Microsoft Research)以及宾夕法尼亚州 ## 安装指南 -FLAML 最新版本要求 **Python >= 3.10 且 < 3.14**。虽然其他 Python 版本可能支持核心组件运行,但无法保证全部模型的完整兼容性。可通过 `pip` 直接安装: +FLAML 支持 **Python 3.10 至 3.14**。虽然其他 Python 版本可能支持核心组件运行,但无法保证全部模型的完整兼容性。可通过 `pip` 直接安装: ```bash pip install flaml @@ -50,6 +50,8 @@ pip install "flaml[automl]" 查阅更多安装选项请见[安装文档 (Installation)](https://microsoft.github.io/FLAML/docs/Installation)。各类[示例 Notebook](https://github.com/microsoft/FLAML/tree/main/notebook) 可能需要安装对应的特定扩展组件。 +如需使用新开源的自动特征工程,请安装 `pip install "flaml[autofe]"`;如需同时使用 MLflow 与可视化且不依赖 Spark,请安装 `pip install "flaml[fabric_python]"`。AutoFE 默认关闭,普通 `flaml[automl]` 安装仍不需要 MLflow、Spark 或 Fabric 服务。升级前请参阅 [3.0 升级说明(英文)](https://microsoft.github.io/FLAML/docs/Installation#upgrading-from-280-to-30)。 + ## 快速上手 - **三行代码即可运行**:作为 [scikit-learn 风格评估器](https://microsoft.github.io/FLAML/docs/Use-Cases/Task-Oriented-AutoML) 体验高效、经济的 AutoML 引擎: @@ -120,4 +122,4 @@ estimator.fit(X_train, y_train) ______________________________________________________________________ -> 💡 **文档维护说明**:本中文文档由社区志愿者(@JasonYeYuhe)翻译维护,最后同步更新于 2026年09月16日。如发现内容与官方英文原版存在差异或新特性滞后,欢迎提交 PR 共同完善! +> 💡 **文档维护说明**:本中文文档由社区志愿者(@JasonYeYuhe)翻译维护,最后同步更新于 2026年12月02日。如发现内容与官方英文原版存在差异或新特性滞后,欢迎提交 PR 共同完善! diff --git a/flaml/version.py b/flaml/version.py index 892994aa6c..528787cfc8 100644 --- a/flaml/version.py +++ b/flaml/version.py @@ -1 +1 @@ -__version__ = "2.8.0" +__version__ = "3.0.0" diff --git a/website/docs/FAQ.md b/website/docs/FAQ.md index e78aed3115..fbeb594c70 100644 --- a/website/docs/FAQ.md +++ b/website/docs/FAQ.md @@ -156,7 +156,15 @@ print(automl.model) You can use `automl.model.estimator.feature_importances_` to get the `feature_importances_` for the best model found by automl. See an [example](Examples/AutoML-for-XGBoost#plot-feature-importance). Packages such as `azureml-interpret` and `sklearn.inspection.permutation_importance` can be used on `automl.model.estimator` to explain the selected model. -Model explanation is frequently asked and adding a native support may be a good feature. Suggestions/contributions are welcome. +FLAML 3.0 also provides native interactive plots through `flaml.visualization`, +including feature importance, optimization history, parallel coordinates, +contours, slices, timelines, and hyperparameter importance. Install +`flaml[fabric_python]` for plotting and MLflow dependencies without Spark. +For history-based AutoML plots outside Fabric, start an MLflow run or enable +autologging before fitting; `model_history=True` alone does not collect that history. +See the [visualization example](Use-Cases/Fabric-Integration#mlflow-and-visualization) +and [runtime contracts](https://github.com/microsoft/FLAML/blob/main/flaml/fabric/README.md) +for requirements and limitations. SHAP remains available through external packages. Optimization history can be checked from the [log](Use-Cases/Task-Oriented-AutoML#log-the-trials). You can also [retrieve the log and plot the learning curve](Use-Cases/Task-Oriented-AutoML#plot-learning-curve). diff --git a/website/docs/Installation.md b/website/docs/Installation.md index 8e82f30bd0..1bba20411a 100644 --- a/website/docs/Installation.md +++ b/website/docs/Installation.md @@ -14,6 +14,29 @@ or conda: conda install flaml -c conda-forge ``` +### Upgrading from 2.8.0 to 3.0 + +FLAML 3.0 consolidates the previously separate Fabric implementation into the +public library. See the [feature guide](Use-Cases/Fabric-Integration) for examples +and a summary of changes since 2.8.0. + +Upgrade with the optional dependencies your workload needs, for example: + +```bash +python -m pip install --upgrade "flaml[automl]" +``` + +The base package still requires only NumPy. AutoFE remains off unless explicitly +enabled, and the AutoML extra does not require MLflow, Spark, or Fabric services. +Inside Fabric, runtime detection enables model retention and, when MLflow is +installed, trial-history collection. Explicit `model_history=False` and +`mlflow_logging=False` opt out of those features. Set `FLAML_FABRIC_RUNTIME=false` +before importing FLAML to select public runtime defaults instead. + +Python 3.10 through 3.14 is supported. For Python 3.14+ Spark environments, +follow the [Spark backend migration instructions](#distributed-tuning) below +before upgrading an existing `joblibspark` installation. + ### Optional Dependencies #### [Task-oriented AutoML](Use-Cases/Task-Oriented-AutoML) @@ -42,6 +65,8 @@ requiring Spark. Use `flaml[synapse]` for the Spark profile. Ordinary `flaml[automl]` installations do not require MLflow or Fabric services. See the [runtime contracts](https://github.com/microsoft/FLAML/blob/main/flaml/fabric/README.md) for detection, explicit overrides, and logging opt-outs. +The [Fabric integration guide](Use-Cases/Fabric-Integration) includes examples +that also run outside Fabric. #### Extra learners/models diff --git a/website/docs/Use-Cases/Fabric-Integration.md b/website/docs/Use-Cases/Fabric-Integration.md new file mode 100644 index 0000000000..b4d5f8c43a --- /dev/null +++ b/website/docs/Use-Cases/Fabric-Integration.md @@ -0,0 +1,159 @@ +# Fabric Features in Public Python + +FLAML 3.0 brings previously Fabric-only functionality into the public library. +The same implementation serves ordinary Python environments and +[Microsoft Fabric Data Science](https://learn.microsoft.com/en-us/fabric/data-science/automated-machine-learning-fabric). +You do not need a Fabric workspace to use AutoFE, pipeline export, or visualization. + +## What's new since 2.8.0 + +- [Fabric feature consolidation](https://github.com/microsoft/FLAML/pull/1545): + opt-in tunable feature engineering, exportable pipelines, expanded AutoML/Tune + MLflow tracking, interactive plots and fANOVA hyperparameter importance, and + improvements to distributed tuning, forecasting, and trial-failure handling. +- [Python 3.14 and Spark 4.2/4.3 support](https://github.com/microsoft/FLAML/pull/1684), + including the compatible `joblibspark-fabric` backend on Python 3.14+. +- [Early binary-target validation](https://github.com/microsoft/FLAML/pull/1685): + explicit binary tasks reject targets without exactly two observed classes + before starting search. +- [Fabric diagnostic compatibility](https://github.com/microsoft/FLAML/pull/1691): + legacy logging formats remain compatible with existing Kusto consumers. +- [API documentation corrections](https://github.com/microsoft/FLAML/pull/1664), + CI runtime fixes, and dependency updates. + +See the [complete comparison with 2.8.0](https://github.com/microsoft/FLAML/compare/v2.8.0...main) +for the merged changes. For environment changes, see the +[upgrade notes](../Installation#upgrading-from-280-to-30). + +## Choose optional dependencies + +For tunable feature engineering without MLflow or Spark: + +```bash +pip install "flaml[autofe]" +``` + +For AutoFE, MLflow, and visualization in a Python environment without Spark: + +```bash +pip install "flaml[fabric_python]" +``` + +For the Spark profile, use `flaml[synapse]`. The base `flaml` package still +requires only NumPy, and `flaml[automl]` does not require Fabric services, +MLflow, or Spark. See [Installation](../Installation) for all profiles. + +## Tunable feature engineering and pipeline export + +AutoFE is **off by default**, including in Fabric. Set `featurization="auto"` +to tune feature engineering along with model hyperparameters, or `"force"` to +require a feature-engineering method at each stage. An explicit setting takes +precedence over the `FLAML_FEATURIZATION` environment variable. + +```python +import numpy as np +from sklearn.datasets import load_diabetes +from sklearn.model_selection import train_test_split + +from flaml import AutoML + +X, y = load_diabetes(return_X_y=True, as_frame=True) +X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) +automl = AutoML(featurization="auto", mlflow_logging=False) +automl.fit( + X_train, + y_train, + task="regression", + estimator_list=["rf"], + max_iter=4, + n_jobs=1, + seed=42, +) + +pipeline = automl.automl_pipeline +np.testing.assert_allclose(pipeline.predict(X_test), automl.predict(X_test)) +``` + +`automl_pipeline` is a detached, fitted scikit-learn-compatible snapshot that +includes task preprocessing and feature engineering. Refitting the snapshot +does not change the source AutoML instance. It is available for models fitted +with AutoFE; it returns `None` when the fitted model has no AutoFE. +Use `automl.feature_transformer` for the detached feature-only pipeline. + +Feature engineering and its preprocessing are fitted on training partitions, +separately for each cross-validation fold, rather than held-out data. +Spark learners, sparse inputs, NLP, panel/TFT forecasting, and ensembles have +AutoFE exclusions. See the +[runtime contracts](https://github.com/microsoft/FLAML/blob/main/flaml/fabric/README.md) +for the supported combinations and refitting limitations. + +## MLflow and visualization + +With `flaml[fabric_python]` installed, use an active MLflow run or enabled +autologging to collect AutoML trial history outside Fabric. Installing MLflow +or setting `model_history=True` alone does not enable that history. + +```python +import mlflow +from sklearn.datasets import load_diabetes + +from flaml import AutoML +from flaml.automl import register_automl_pipeline +from flaml.visualization import plot_optimization_history + +X, y = load_diabetes(return_X_y=True, as_frame=True) +mlflow.set_experiment("flaml-3-quickstart") +with mlflow.start_run(): + automl = AutoML(featurization="auto") + automl.fit( + X, + y, + task="regression", + estimator_list=["rf"], + max_iter=4, + n_jobs=1, + seed=42, + ) + model_version = register_automl_pipeline(automl, model_name="diabetes-pipeline") + +figure = plot_optimization_history(automl) +figure.show() +``` + +Configure an MLflow tracking store and model registry appropriate for your +environment before running the example. Registration logs the current fitted +pipeline, even when model history is disabled; it requires AutoFE and MLflow. +An autologging `log_models=False` setting suppresses automatic model artifacts, +but an explicit `register_automl_pipeline()` call still registers the pipeline. + +`flaml.visualization` also provides feature-importance, parallel-coordinate, +contour, slice, timeline, empirical-distribution, and parameter-importance plots. +Parameter importance uses fANOVA and requires enough completed trials with +varying scores. See the +[plotting example and limitations](https://github.com/microsoft/FLAML/blob/main/flaml/fabric/README.md#plotting-outside-fabric). + +For parallel MLflow tracking with native Ray, use a transactional store such as +SQLite for local workers, or a reachable tracking server for multi-host +clusters. File-based tracking is rejected for native Ray; it remains available +for non-Ray workloads. + +## Runtime defaults and opt-outs + +FLAML detects Fabric from its notebook marker or Spark runtime context file, +without starting Spark or contacting a service. Installing PySpark or SynapseML +alone does not enable Fabric defaults. + +Outside Fabric, model history defaults to `False`. Inside Fabric it defaults +to `True`, and MLflow, when installed, also supports trial-history collection. +History-only collection without an active run or autologging stays in memory; +it does not configure an experiment or contact Fabric services. + +Explicit options override runtime defaults: `model_history=False` avoids +retaining intermediate models, and `mlflow_logging=False` disables FLAML's MLflow +integration in both AutoML and `tune.run()`. + +Set `FLAML_FABRIC_RUNTIME` **before importing FLAML** to select `auto` (default), +`true`/`1` (Fabric defaults), or `false`/`0` (public defaults). +The override does not emulate Fabric services or configure credentials. +See the [full runtime contracts](https://github.com/microsoft/FLAML/blob/main/flaml/fabric/README.md) +for logging, telemetry, pipeline, and distributed-execution details. diff --git a/website/docs/Use-Cases/Task-Oriented-AutoML.md b/website/docs/Use-Cases/Task-Oriented-AutoML.md index 3c377ccf15..d7a8d0507b 100644 --- a/website/docs/Use-Cases/Task-Oriented-AutoML.md +++ b/website/docs/Use-Cases/Task-Oriented-AutoML.md @@ -44,6 +44,14 @@ especially when Spark estimators are involved. If users provide the minimal inputs only, `AutoML` uses the default settings for optimization metric, estimator list etc. +FLAML 3.0 adds opt-in [tunable feature engineering and pipeline export](Fabric-Integration#tunable-feature-engineering-and-pipeline-export), +plus [MLflow integration and visualization](Fabric-Integration#mlflow-and-visualization) +shared with Microsoft Fabric. These features can also be used in ordinary Python environments. + +An explicit `task="binary"` requires exactly two observed target classes and now +raises a `ValueError` before search otherwise. Use `task="classification"` for +automatic binary/multiclass inference, or `task="multiclass"` for multiclass targets. + ## Customize AutoML.fit() ### Optimization metric