FLAML 2.6.0__tar.gz → 2.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flaml-2.6.0 → flaml-2.7.0}/FLAML.egg-info/PKG-INFO +22 -15
- {flaml-2.6.0 → flaml-2.7.0}/FLAML.egg-info/requires.txt +19 -12
- {flaml-2.6.0 → flaml-2.7.0}/PKG-INFO +22 -15
- {flaml-2.6.0 → flaml-2.7.0}/README.md +6 -2
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/automl.py +97 -2
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/data.py +36 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/ml.py +14 -2
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/model.py +30 -4
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/task/generic_task.py +25 -1
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/time_series/ts_model.py +34 -5
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/sample.py +1 -1
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/searcher/flow2.py +6 -3
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/trial.py +3 -1
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/trial_runner.py +1 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/tune.py +1 -1
- flaml-2.7.0/flaml/version.py +1 -0
- {flaml-2.6.0 → flaml-2.7.0}/pyproject.toml +15 -12
- {flaml-2.6.0 → flaml-2.7.0}/test/test_gpu.py +8 -1
- flaml-2.6.0/flaml/version.py +0 -1
- {flaml-2.6.0 → flaml-2.7.0}/FLAML.egg-info/SOURCES.txt +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/FLAML.egg-info/dependency_links.txt +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/FLAML.egg-info/top_level.txt +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/LICENSE +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/NOTICE.md +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/agentchat/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/agentchat/agent.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/agentchat/assistant_agent.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/agentchat/contrib/math_user_proxy_agent.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/agentchat/contrib/retrieve_assistant_agent.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/agentchat/contrib/retrieve_user_proxy_agent.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/agentchat/conversable_agent.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/agentchat/groupchat.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/agentchat/user_proxy_agent.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/code_utils.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/extensions/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/math_utils.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/oai/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/oai/completion.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/oai/openai_utils.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/autogen/retrieve_utils.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/contrib/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/contrib/histgb.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/logger.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/nlp/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/nlp/huggingface/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/nlp/huggingface/data_collator.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/nlp/huggingface/trainer.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/nlp/huggingface/training_args.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/nlp/huggingface/utils.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/nlp/utils.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/spark/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/spark/metrics.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/spark/utils.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/state.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/task/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/task/factory.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/task/task.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/task/time_series_task.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/time_series/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/time_series/feature.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/time_series/sklearn.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/time_series/tcn.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/time_series/tft.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/time_series/ts_data.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/automl/training_log.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/config.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/all/binary.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/all/multiclass.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/all/regression.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/estimator.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/extra_tree/binary.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/extra_tree/multiclass.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/extra_tree/regression.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/greedy.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/lgbm/binary.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/lgbm/multiclass.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/lgbm/regression.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/portfolio.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/regret.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/rf/binary.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/rf/multiclass.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/rf/regression.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/suggest.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/xgb_limitdepth/binary.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/xgb_limitdepth/multiclass.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/xgb_limitdepth/regression.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/xgboost/binary.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/xgboost/multiclass.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/default/xgboost/regression.json +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/fabric/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/fabric/mlflow.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/ml.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/onlineml/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/onlineml/autovw.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/onlineml/trial.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/onlineml/trial_runner.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/py.typed +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/analysis.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/logger.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/result.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/scheduler/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/scheduler/online_scheduler.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/scheduler/trial_scheduler.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/searcher/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/searcher/blendsearch.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/searcher/cfo_cat.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/searcher/online_searcher.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/searcher/search_thread.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/searcher/suggestion.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/searcher/variant_generator.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/space.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/spark/__init__.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/spark/utils.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/flaml/tune/utils.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/setup.cfg +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/setup.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/test/test_autovw.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/test/test_conda_distribution.py +0 -0
- {flaml-2.6.0 → flaml-2.7.0}/test/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: FLAML
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.7.0
|
|
4
4
|
Summary: A fast library for automated machine learning and tuning
|
|
5
5
|
Author-email: Microsoft Corporation <hpo@microsoft.com>
|
|
6
6
|
License: MIT
|
|
@@ -31,8 +31,8 @@ Requires-Dist: pandas<3; extra == "spark"
|
|
|
31
31
|
Requires-Dist: joblibspark>=0.5.0; extra == "spark"
|
|
32
32
|
Requires-Dist: joblib<=1.3.2; extra == "spark"
|
|
33
33
|
Provides-Extra: test
|
|
34
|
-
Requires-Dist: numpy<2.0.0,>=1.17; python_version < "3.13" and extra == "test"
|
|
35
|
-
Requires-Dist: numpy>=1.17; python_version >= "3.13" and extra == "test"
|
|
34
|
+
Requires-Dist: numpy<2.0.0,>=1.17; (python_version < "3.13" and (sys_platform != "win32" or platform_machine != "ARM64")) and extra == "test"
|
|
35
|
+
Requires-Dist: numpy>=1.17; (python_version >= "3.13" or (sys_platform == "win32" and platform_machine == "ARM64")) and extra == "test"
|
|
36
36
|
Requires-Dist: jupyter; extra == "test"
|
|
37
37
|
Requires-Dist: lightgbm>=2.3.1; extra == "test"
|
|
38
38
|
Requires-Dist: xgboost<2.0.0,>=0.90; python_version < "3.11" and extra == "test"
|
|
@@ -40,34 +40,37 @@ Requires-Dist: xgboost>=2.0.0; python_version >= "3.11" and extra == "test"
|
|
|
40
40
|
Requires-Dist: scipy>=1.4.1; extra == "test"
|
|
41
41
|
Requires-Dist: pandas>=1.1.4; extra == "test"
|
|
42
42
|
Requires-Dist: scikit-learn>=1.2.0; extra == "test"
|
|
43
|
-
Requires-Dist: thop; extra == "test"
|
|
43
|
+
Requires-Dist: thop; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
44
44
|
Requires-Dist: pytest>=6.1.1; extra == "test"
|
|
45
45
|
Requires-Dist: pytest-rerunfailures>=13.0; extra == "test"
|
|
46
|
+
Requires-Dist: pytest-asyncio; (sys_platform == "win32" and platform_machine == "ARM64") and extra == "test"
|
|
46
47
|
Requires-Dist: coverage>=5.3; extra == "test"
|
|
47
48
|
Requires-Dist: pre-commit; extra == "test"
|
|
48
|
-
Requires-Dist: torch; extra == "test"
|
|
49
|
-
Requires-Dist: torchvision; extra == "test"
|
|
50
|
-
Requires-Dist: catboost>=0.26; extra == "test"
|
|
49
|
+
Requires-Dist: torch; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
50
|
+
Requires-Dist: torchvision; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
51
|
+
Requires-Dist: catboost>=0.26; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
51
52
|
Requires-Dist: rgf-python; extra == "test"
|
|
52
53
|
Requires-Dist: optuna<=3.6.1,>=2.8.0; extra == "test"
|
|
53
|
-
Requires-Dist: openml; extra == "test"
|
|
54
|
+
Requires-Dist: openml; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
54
55
|
Requires-Dist: statsmodels>=0.12.2; extra == "test"
|
|
55
56
|
Requires-Dist: psutil; extra == "test"
|
|
56
|
-
Requires-Dist: transformers[torch]; extra == "test"
|
|
57
|
-
Requires-Dist:
|
|
58
|
-
Requires-Dist:
|
|
57
|
+
Requires-Dist: transformers[torch]; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
58
|
+
Requires-Dist: transformers; (sys_platform == "win32" and platform_machine == "ARM64") and extra == "test"
|
|
59
|
+
Requires-Dist: datasets; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
60
|
+
Requires-Dist: evaluate; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
59
61
|
Requires-Dist: nltk!=3.8.2; extra == "test"
|
|
60
62
|
Requires-Dist: rouge_score; extra == "test"
|
|
61
63
|
Requires-Dist: hcrystalball; extra == "test"
|
|
62
64
|
Requires-Dist: seqeval; extra == "test"
|
|
63
|
-
Requires-Dist: pytorch-forecasting; extra == "test"
|
|
65
|
+
Requires-Dist: pytorch-forecasting; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
66
|
+
Requires-Dist: cryptography==46.0.3; (sys_platform == "win32" and platform_machine == "ARM64") and extra == "test"
|
|
64
67
|
Requires-Dist: mlflow-skinny<=2.22.1; extra == "test"
|
|
65
68
|
Requires-Dist: joblibspark>=0.5.0; extra == "test"
|
|
66
69
|
Requires-Dist: joblib<=1.3.2; extra == "test"
|
|
67
70
|
Requires-Dist: nbconvert; extra == "test"
|
|
68
71
|
Requires-Dist: nbformat; extra == "test"
|
|
69
72
|
Requires-Dist: ipykernel; extra == "test"
|
|
70
|
-
Requires-Dist: pytorch-lightning; extra == "test"
|
|
73
|
+
Requires-Dist: pytorch-lightning; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
71
74
|
Requires-Dist: tensorboardX; extra == "test"
|
|
72
75
|
Requires-Dist: requests; extra == "test"
|
|
73
76
|
Requires-Dist: packaging; extra == "test"
|
|
@@ -142,6 +145,10 @@ Dynamic: license-file
|
|
|
142
145
|
<br>
|
|
143
146
|
</p>
|
|
144
147
|
|
|
148
|
+
<p align="center">
|
|
149
|
+
<b>English</b> · <a href="https://github.com/microsoft/FLAML/blob/main/README.zh.md">简体中文</a>
|
|
150
|
+
</p>
|
|
151
|
+
|
|
145
152
|
: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.
|
|
146
153
|
|
|
147
154
|
: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.
|
|
@@ -202,7 +209,7 @@ automl.fit(X_train, y_train, task="classification", estimator_list=["lgbm"])
|
|
|
202
209
|
from flaml import tune
|
|
203
210
|
|
|
204
211
|
tune.run(
|
|
205
|
-
evaluation_function, config={
|
|
212
|
+
evaluation_function, config={...}, low_cost_partial_config={...}, time_budget_s=3600
|
|
206
213
|
)
|
|
207
214
|
```
|
|
208
215
|
|
|
@@ -237,7 +244,7 @@ This project welcomes contributions and suggestions. Most contributions require
|
|
|
237
244
|
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
|
238
245
|
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.
|
|
239
246
|
|
|
240
|
-
If you are new to GitHub [here](https://
|
|
247
|
+
If you are new to GitHub [here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests) is a detailed help source on getting involved with development on GitHub.
|
|
241
248
|
|
|
242
249
|
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
|
243
250
|
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
|
@@ -77,34 +77,24 @@ lightgbm>=2.3.1
|
|
|
77
77
|
scipy>=1.4.1
|
|
78
78
|
pandas>=1.1.4
|
|
79
79
|
scikit-learn>=1.2.0
|
|
80
|
-
thop
|
|
81
80
|
pytest>=6.1.1
|
|
82
81
|
pytest-rerunfailures>=13.0
|
|
83
82
|
coverage>=5.3
|
|
84
83
|
pre-commit
|
|
85
|
-
torch
|
|
86
|
-
torchvision
|
|
87
|
-
catboost>=0.26
|
|
88
84
|
rgf-python
|
|
89
85
|
optuna<=3.6.1,>=2.8.0
|
|
90
|
-
openml
|
|
91
86
|
statsmodels>=0.12.2
|
|
92
87
|
psutil
|
|
93
|
-
transformers[torch]
|
|
94
|
-
datasets
|
|
95
|
-
evaluate
|
|
96
88
|
nltk!=3.8.2
|
|
97
89
|
rouge_score
|
|
98
90
|
hcrystalball
|
|
99
91
|
seqeval
|
|
100
|
-
pytorch-forecasting
|
|
101
92
|
mlflow-skinny<=2.22.1
|
|
102
93
|
joblibspark>=0.5.0
|
|
103
94
|
joblib<=1.3.2
|
|
104
95
|
nbconvert
|
|
105
96
|
nbformat
|
|
106
97
|
ipykernel
|
|
107
|
-
pytorch-lightning
|
|
108
98
|
tensorboardX
|
|
109
99
|
requests
|
|
110
100
|
packaging
|
|
@@ -113,15 +103,32 @@ dill
|
|
|
113
103
|
[test:python_version < "3.11"]
|
|
114
104
|
xgboost<2.0.0,>=0.90
|
|
115
105
|
|
|
116
|
-
[test:python_version < "3.13"]
|
|
106
|
+
[test:python_version < "3.13" and (sys_platform != "win32" or platform_machine != "ARM64")]
|
|
117
107
|
numpy<2.0.0,>=1.17
|
|
118
108
|
|
|
119
109
|
[test:python_version >= "3.11"]
|
|
120
110
|
xgboost>=2.0.0
|
|
121
111
|
|
|
122
|
-
[test:python_version >= "3.13"]
|
|
112
|
+
[test:python_version >= "3.13" or (sys_platform == "win32" and platform_machine == "ARM64")]
|
|
123
113
|
numpy>=1.17
|
|
124
114
|
|
|
115
|
+
[test:sys_platform != "win32" or platform_machine != "ARM64"]
|
|
116
|
+
thop
|
|
117
|
+
torch
|
|
118
|
+
torchvision
|
|
119
|
+
catboost>=0.26
|
|
120
|
+
openml
|
|
121
|
+
transformers[torch]
|
|
122
|
+
datasets
|
|
123
|
+
evaluate
|
|
124
|
+
pytorch-forecasting
|
|
125
|
+
pytorch-lightning
|
|
126
|
+
|
|
127
|
+
[test:sys_platform == "win32" and platform_machine == "ARM64"]
|
|
128
|
+
pytest-asyncio
|
|
129
|
+
transformers
|
|
130
|
+
cryptography==46.0.3
|
|
131
|
+
|
|
125
132
|
[ts_forecast]
|
|
126
133
|
holidays
|
|
127
134
|
prophet>=1.1.5
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: FLAML
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.7.0
|
|
4
4
|
Summary: A fast library for automated machine learning and tuning
|
|
5
5
|
Author-email: Microsoft Corporation <hpo@microsoft.com>
|
|
6
6
|
License: MIT
|
|
@@ -31,8 +31,8 @@ Requires-Dist: pandas<3; extra == "spark"
|
|
|
31
31
|
Requires-Dist: joblibspark>=0.5.0; extra == "spark"
|
|
32
32
|
Requires-Dist: joblib<=1.3.2; extra == "spark"
|
|
33
33
|
Provides-Extra: test
|
|
34
|
-
Requires-Dist: numpy<2.0.0,>=1.17; python_version < "3.13" and extra == "test"
|
|
35
|
-
Requires-Dist: numpy>=1.17; python_version >= "3.13" and extra == "test"
|
|
34
|
+
Requires-Dist: numpy<2.0.0,>=1.17; (python_version < "3.13" and (sys_platform != "win32" or platform_machine != "ARM64")) and extra == "test"
|
|
35
|
+
Requires-Dist: numpy>=1.17; (python_version >= "3.13" or (sys_platform == "win32" and platform_machine == "ARM64")) and extra == "test"
|
|
36
36
|
Requires-Dist: jupyter; extra == "test"
|
|
37
37
|
Requires-Dist: lightgbm>=2.3.1; extra == "test"
|
|
38
38
|
Requires-Dist: xgboost<2.0.0,>=0.90; python_version < "3.11" and extra == "test"
|
|
@@ -40,34 +40,37 @@ Requires-Dist: xgboost>=2.0.0; python_version >= "3.11" and extra == "test"
|
|
|
40
40
|
Requires-Dist: scipy>=1.4.1; extra == "test"
|
|
41
41
|
Requires-Dist: pandas>=1.1.4; extra == "test"
|
|
42
42
|
Requires-Dist: scikit-learn>=1.2.0; extra == "test"
|
|
43
|
-
Requires-Dist: thop; extra == "test"
|
|
43
|
+
Requires-Dist: thop; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
44
44
|
Requires-Dist: pytest>=6.1.1; extra == "test"
|
|
45
45
|
Requires-Dist: pytest-rerunfailures>=13.0; extra == "test"
|
|
46
|
+
Requires-Dist: pytest-asyncio; (sys_platform == "win32" and platform_machine == "ARM64") and extra == "test"
|
|
46
47
|
Requires-Dist: coverage>=5.3; extra == "test"
|
|
47
48
|
Requires-Dist: pre-commit; extra == "test"
|
|
48
|
-
Requires-Dist: torch; extra == "test"
|
|
49
|
-
Requires-Dist: torchvision; extra == "test"
|
|
50
|
-
Requires-Dist: catboost>=0.26; extra == "test"
|
|
49
|
+
Requires-Dist: torch; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
50
|
+
Requires-Dist: torchvision; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
51
|
+
Requires-Dist: catboost>=0.26; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
51
52
|
Requires-Dist: rgf-python; extra == "test"
|
|
52
53
|
Requires-Dist: optuna<=3.6.1,>=2.8.0; extra == "test"
|
|
53
|
-
Requires-Dist: openml; extra == "test"
|
|
54
|
+
Requires-Dist: openml; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
54
55
|
Requires-Dist: statsmodels>=0.12.2; extra == "test"
|
|
55
56
|
Requires-Dist: psutil; extra == "test"
|
|
56
|
-
Requires-Dist: transformers[torch]; extra == "test"
|
|
57
|
-
Requires-Dist:
|
|
58
|
-
Requires-Dist:
|
|
57
|
+
Requires-Dist: transformers[torch]; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
58
|
+
Requires-Dist: transformers; (sys_platform == "win32" and platform_machine == "ARM64") and extra == "test"
|
|
59
|
+
Requires-Dist: datasets; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
60
|
+
Requires-Dist: evaluate; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
59
61
|
Requires-Dist: nltk!=3.8.2; extra == "test"
|
|
60
62
|
Requires-Dist: rouge_score; extra == "test"
|
|
61
63
|
Requires-Dist: hcrystalball; extra == "test"
|
|
62
64
|
Requires-Dist: seqeval; extra == "test"
|
|
63
|
-
Requires-Dist: pytorch-forecasting; extra == "test"
|
|
65
|
+
Requires-Dist: pytorch-forecasting; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
66
|
+
Requires-Dist: cryptography==46.0.3; (sys_platform == "win32" and platform_machine == "ARM64") and extra == "test"
|
|
64
67
|
Requires-Dist: mlflow-skinny<=2.22.1; extra == "test"
|
|
65
68
|
Requires-Dist: joblibspark>=0.5.0; extra == "test"
|
|
66
69
|
Requires-Dist: joblib<=1.3.2; extra == "test"
|
|
67
70
|
Requires-Dist: nbconvert; extra == "test"
|
|
68
71
|
Requires-Dist: nbformat; extra == "test"
|
|
69
72
|
Requires-Dist: ipykernel; extra == "test"
|
|
70
|
-
Requires-Dist: pytorch-lightning; extra == "test"
|
|
73
|
+
Requires-Dist: pytorch-lightning; (sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
71
74
|
Requires-Dist: tensorboardX; extra == "test"
|
|
72
75
|
Requires-Dist: requests; extra == "test"
|
|
73
76
|
Requires-Dist: packaging; extra == "test"
|
|
@@ -142,6 +145,10 @@ Dynamic: license-file
|
|
|
142
145
|
<br>
|
|
143
146
|
</p>
|
|
144
147
|
|
|
148
|
+
<p align="center">
|
|
149
|
+
<b>English</b> · <a href="https://github.com/microsoft/FLAML/blob/main/README.zh.md">简体中文</a>
|
|
150
|
+
</p>
|
|
151
|
+
|
|
145
152
|
: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.
|
|
146
153
|
|
|
147
154
|
: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.
|
|
@@ -202,7 +209,7 @@ automl.fit(X_train, y_train, task="classification", estimator_list=["lgbm"])
|
|
|
202
209
|
from flaml import tune
|
|
203
210
|
|
|
204
211
|
tune.run(
|
|
205
|
-
evaluation_function, config={
|
|
212
|
+
evaluation_function, config={...}, low_cost_partial_config={...}, time_budget_s=3600
|
|
206
213
|
)
|
|
207
214
|
```
|
|
208
215
|
|
|
@@ -237,7 +244,7 @@ This project welcomes contributions and suggestions. Most contributions require
|
|
|
237
244
|
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
|
238
245
|
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.
|
|
239
246
|
|
|
240
|
-
If you are new to GitHub [here](https://
|
|
247
|
+
If you are new to GitHub [here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests) is a detailed help source on getting involved with development on GitHub.
|
|
241
248
|
|
|
242
249
|
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
|
243
250
|
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
<br>
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
|
+
<p align="center">
|
|
18
|
+
<b>English</b> · <a href="https://github.com/microsoft/FLAML/blob/main/README.zh.md">简体中文</a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
17
21
|
: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.
|
|
18
22
|
|
|
19
23
|
: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.
|
|
@@ -74,7 +78,7 @@ automl.fit(X_train, y_train, task="classification", estimator_list=["lgbm"])
|
|
|
74
78
|
from flaml import tune
|
|
75
79
|
|
|
76
80
|
tune.run(
|
|
77
|
-
evaluation_function, config={
|
|
81
|
+
evaluation_function, config={...}, low_cost_partial_config={...}, time_budget_s=3600
|
|
78
82
|
)
|
|
79
83
|
```
|
|
80
84
|
|
|
@@ -109,7 +113,7 @@ This project welcomes contributions and suggestions. Most contributions require
|
|
|
109
113
|
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
|
110
114
|
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.
|
|
111
115
|
|
|
112
|
-
If you are new to GitHub [here](https://
|
|
116
|
+
If you are new to GitHub [here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests) is a detailed help source on getting involved with development on GitHub.
|
|
113
117
|
|
|
114
118
|
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
|
115
119
|
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
|
@@ -19,7 +19,12 @@ import numpy as np
|
|
|
19
19
|
|
|
20
20
|
from flaml import tune
|
|
21
21
|
from flaml.automl.logger import logger, logger_formatter
|
|
22
|
-
from flaml.automl.ml import
|
|
22
|
+
from flaml.automl.ml import (
|
|
23
|
+
huggingface_metric_to_mode,
|
|
24
|
+
sklearn_metric_name_set,
|
|
25
|
+
spark_metric_name_dict,
|
|
26
|
+
train_estimator,
|
|
27
|
+
)
|
|
23
28
|
from flaml.automl.spark import DataFrame, Series, psDataFrame, psSeries
|
|
24
29
|
from flaml.automl.state import AutoMLState, SearchState
|
|
25
30
|
from flaml.automl.task.factory import task_factory
|
|
@@ -285,6 +290,9 @@ class AutoML(BaseEstimator):
|
|
|
285
290
|
records to the input log file if it exists.
|
|
286
291
|
auto_augment: boolean, default=True | Whether to automatically
|
|
287
292
|
augment rare classes.
|
|
293
|
+
resampler: object, default=None | An imbalanced-learn-compatible resampler
|
|
294
|
+
to apply to training partitions. It must be cloneable via
|
|
295
|
+
`sklearn.base.clone` and expose `fit_resample(X, y) -> (X, y)`.
|
|
288
296
|
min_sample_size: int, default=MIN_SAMPLE_TRAIN | the minimal sample
|
|
289
297
|
size when sample=True.
|
|
290
298
|
use_ray: boolean or dict.
|
|
@@ -419,6 +427,7 @@ class AutoML(BaseEstimator):
|
|
|
419
427
|
settings["custom_hp"] = settings.get("custom_hp", {})
|
|
420
428
|
settings["skip_transform"] = settings.get("skip_transform", False)
|
|
421
429
|
settings["mlflow_logging"] = settings.get("mlflow_logging", True)
|
|
430
|
+
settings["resampler"] = settings.get("resampler")
|
|
422
431
|
|
|
423
432
|
self._estimator_type = "classifier" if settings["task"] in CLASSIFICATION else "regressor"
|
|
424
433
|
self.best_run_id = None
|
|
@@ -497,6 +506,51 @@ class AutoML(BaseEstimator):
|
|
|
497
506
|
f"(e.g., metric=custom_metric(...))."
|
|
498
507
|
)
|
|
499
508
|
|
|
509
|
+
@staticmethod
|
|
510
|
+
def _validate_resampler(resampler, groups, ensemble, fit_kwargs, fit_kwargs_by_estimator):
|
|
511
|
+
if resampler is None:
|
|
512
|
+
return fit_kwargs, fit_kwargs_by_estimator
|
|
513
|
+
if ensemble:
|
|
514
|
+
raise ValueError(
|
|
515
|
+
"Cannot combine 'resampler' with 'ensemble' because stacking performs "
|
|
516
|
+
"internal cross-validation where pre-resampling can leak synthetic samples "
|
|
517
|
+
"across folds. Disable ensemble or omit resampler."
|
|
518
|
+
)
|
|
519
|
+
metadata_sources = [fit_kwargs] + list((fit_kwargs_by_estimator or {}).values())
|
|
520
|
+
if any(kwargs.get("sample_weight") is not None for kwargs in metadata_sources):
|
|
521
|
+
raise ValueError(
|
|
522
|
+
"Cannot combine 'resampler' with 'sample_weight' (including via "
|
|
523
|
+
"fit_kwargs_by_estimator) — resampling breaks the 1-to-1 row alignment "
|
|
524
|
+
"with sample weights. Use either resampling or sample weighting, not both."
|
|
525
|
+
)
|
|
526
|
+
if groups is not None or any(kwargs.get("groups") is not None for kwargs in metadata_sources):
|
|
527
|
+
raise ValueError(
|
|
528
|
+
"Cannot combine 'resampler' with 'groups' because resampling breaks the "
|
|
529
|
+
"1-to-1 row alignment with group labels."
|
|
530
|
+
)
|
|
531
|
+
if not callable(getattr(resampler, "fit_resample", None)):
|
|
532
|
+
raise TypeError(
|
|
533
|
+
"'resampler' must expose a fit_resample(X, y) -> (X, y) method "
|
|
534
|
+
"(e.g., an imbalanced-learn BaseSampler such as SMOTE)."
|
|
535
|
+
)
|
|
536
|
+
try:
|
|
537
|
+
from sklearn.base import clone
|
|
538
|
+
|
|
539
|
+
clone(resampler)
|
|
540
|
+
except Exception as e:
|
|
541
|
+
raise TypeError(
|
|
542
|
+
"'resampler' must be cloneable via sklearn.base.clone (implement "
|
|
543
|
+
"get_params/set_params, e.g. by subclassing sklearn.base.BaseEstimator); "
|
|
544
|
+
f"cloning failed with: {e}"
|
|
545
|
+
) from e
|
|
546
|
+
return (
|
|
547
|
+
{key: value for key, value in fit_kwargs.items() if key != "sample_weight"},
|
|
548
|
+
{
|
|
549
|
+
name: {key: value for key, value in kwargs.items() if key != "sample_weight"}
|
|
550
|
+
for name, kwargs in (fit_kwargs_by_estimator or {}).items()
|
|
551
|
+
},
|
|
552
|
+
)
|
|
553
|
+
|
|
500
554
|
def get_params(self, deep: bool = False) -> dict:
|
|
501
555
|
return self._settings.copy()
|
|
502
556
|
|
|
@@ -890,6 +944,14 @@ class AutoML(BaseEstimator):
|
|
|
890
944
|
|
|
891
945
|
# Apply task-level preprocessing to new data
|
|
892
946
|
X_test_preprocessed = automl.preprocess(X_test)
|
|
947
|
+
|
|
948
|
+
# Required when calling a single ensemble component directly, since
|
|
949
|
+
# `automl.model.estimators_[i]` was fitted on already-preprocessed
|
|
950
|
+
# data and cannot consume raw input (see issue #1136):
|
|
951
|
+
automl_ensemble = AutoML()
|
|
952
|
+
automl_ensemble.fit(X_train, y_train, task="classification", ensemble=True)
|
|
953
|
+
X_test_preprocessed = automl_ensemble.preprocess(X_test)
|
|
954
|
+
component_pred = automl_ensemble.model.estimators_[0].predict(X_test_preprocessed)
|
|
893
955
|
```
|
|
894
956
|
"""
|
|
895
957
|
if not hasattr(self, "_state") or self._state is None:
|
|
@@ -966,6 +1028,8 @@ class AutoML(BaseEstimator):
|
|
|
966
1028
|
skip_transform=None,
|
|
967
1029
|
preserve_checkpoint=True,
|
|
968
1030
|
fit_kwargs_by_estimator=None,
|
|
1031
|
+
*,
|
|
1032
|
+
resampler=None,
|
|
969
1033
|
**fit_kwargs,
|
|
970
1034
|
):
|
|
971
1035
|
"""Retrain from log file.
|
|
@@ -1025,6 +1089,9 @@ class AutoML(BaseEstimator):
|
|
|
1025
1089
|
when `record_id >= 0`, `time_budget` will be ignored.
|
|
1026
1090
|
auto_augment: boolean, default=True | Whether to automatically
|
|
1027
1091
|
augment rare classes.
|
|
1092
|
+
resampler: object, default=None | An imbalanced-learn-compatible resampler
|
|
1093
|
+
to apply before retraining. It must be cloneable via `sklearn.base.clone`
|
|
1094
|
+
and expose `fit_resample(X, y) -> (X, y)`.
|
|
1028
1095
|
custom_hp: dict, default=None | The custom search space specified by user
|
|
1029
1096
|
Each key is the estimator name, each value is a dict of the custom search space for that estimator. Notice the
|
|
1030
1097
|
domain of the custom search space can either be a value or a sample.Domain object.
|
|
@@ -1095,6 +1162,9 @@ class AutoML(BaseEstimator):
|
|
|
1095
1162
|
n_splits = n_splits or self._settings.get("n_splits")
|
|
1096
1163
|
split_type = split_type or self._settings.get("split_type")
|
|
1097
1164
|
auto_augment = self._settings.get("auto_augment") if auto_augment is None else auto_augment
|
|
1165
|
+
resampler = self._settings.get("resampler") if resampler is None else resampler
|
|
1166
|
+
if resampler is not None:
|
|
1167
|
+
auto_augment = False
|
|
1098
1168
|
self._state.task = task
|
|
1099
1169
|
self._estimator_type = "classifier" if task.is_classification() else "regressor"
|
|
1100
1170
|
|
|
@@ -1102,6 +1172,11 @@ class AutoML(BaseEstimator):
|
|
|
1102
1172
|
self._state.custom_hp = custom_hp or self._settings.get("custom_hp")
|
|
1103
1173
|
self._skip_transform = self._settings.get("skip_transform") if skip_transform is None else skip_transform
|
|
1104
1174
|
self._state.fit_kwargs_by_estimator = fit_kwargs_by_estimator or self._settings.get("fit_kwargs_by_estimator")
|
|
1175
|
+
fit_kwargs, self._state.fit_kwargs_by_estimator = self._validate_resampler(
|
|
1176
|
+
resampler, groups, False, fit_kwargs, self._state.fit_kwargs_by_estimator
|
|
1177
|
+
)
|
|
1178
|
+
self._state.fit_kwargs = fit_kwargs
|
|
1179
|
+
task._resampler = resampler
|
|
1105
1180
|
self.preserve_checkpoint = (
|
|
1106
1181
|
self._settings.get("preserve_checkpoint") if preserve_checkpoint is None else preserve_checkpoint
|
|
1107
1182
|
)
|
|
@@ -1837,6 +1912,8 @@ class AutoML(BaseEstimator):
|
|
|
1837
1912
|
mlflow_logging=None,
|
|
1838
1913
|
fit_kwargs_by_estimator=None,
|
|
1839
1914
|
mlflow_exp_name=None,
|
|
1915
|
+
*,
|
|
1916
|
+
resampler=None,
|
|
1840
1917
|
**fit_kwargs,
|
|
1841
1918
|
):
|
|
1842
1919
|
"""Find a model for a given task.
|
|
@@ -2155,6 +2232,17 @@ class AutoML(BaseEstimator):
|
|
|
2155
2232
|
}
|
|
2156
2233
|
```
|
|
2157
2234
|
|
|
2235
|
+
resampler: object, default=None | An imbalanced-learn-compatible resampler
|
|
2236
|
+
(such as `imblearn.over_sampling.SMOTE`) that is cloneable via
|
|
2237
|
+
`sklearn.base.clone` and exposes `fit_resample(X, y) -> (X, y)`. When set,
|
|
2238
|
+
the resampler is cloned and applied to each cross-validation fold's training
|
|
2239
|
+
partition, the holdout training partition, and final or retrain data.
|
|
2240
|
+
Validation partitions are left at the raw class distribution, and automatic
|
|
2241
|
+
rare-class augmentation is disabled. Automatically generated classification
|
|
2242
|
+
holdout partitions are disjoint; singleton classes raise `ValueError`.
|
|
2243
|
+
Not compatible with non-null `sample_weight`,
|
|
2244
|
+
`groups`, or `ensemble`; passing these combinations raises `ValueError`.
|
|
2245
|
+
Off by default. See issue #1200 for the design discussion and benchmarks.
|
|
2158
2246
|
**fit_kwargs: Other key word arguments to pass to fit() function of
|
|
2159
2247
|
the searched learners, such as sample_weight. Below are a few examples of
|
|
2160
2248
|
estimator-specific parameters:
|
|
@@ -2203,6 +2291,9 @@ class AutoML(BaseEstimator):
|
|
|
2203
2291
|
split_ratio = split_ratio or self._settings.get("split_ratio")
|
|
2204
2292
|
n_splits = n_splits or self._settings.get("n_splits")
|
|
2205
2293
|
auto_augment = self._settings.get("auto_augment") if auto_augment is None else auto_augment
|
|
2294
|
+
resampler = self._settings.get("resampler") if resampler is None else resampler
|
|
2295
|
+
if resampler is not None:
|
|
2296
|
+
auto_augment = False
|
|
2206
2297
|
allow_label_overlap = (
|
|
2207
2298
|
self._settings.get("allow_label_overlap") if allow_label_overlap is None else allow_label_overlap
|
|
2208
2299
|
)
|
|
@@ -2328,6 +2419,11 @@ class AutoML(BaseEstimator):
|
|
|
2328
2419
|
self._state.resources_per_trial = {"cpu": n_jobs} if n_jobs > 0 else {"cpu": 1}
|
|
2329
2420
|
self._state.free_mem_ratio = self._settings.get("free_mem_ratio") if free_mem_ratio is None else free_mem_ratio
|
|
2330
2421
|
self._state.task = task
|
|
2422
|
+
fit_kwargs_by_estimator = fit_kwargs_by_estimator or self._settings.get("fit_kwargs_by_estimator")
|
|
2423
|
+
fit_kwargs, fit_kwargs_by_estimator = self._validate_resampler(
|
|
2424
|
+
resampler, groups, ensemble, fit_kwargs, fit_kwargs_by_estimator
|
|
2425
|
+
)
|
|
2426
|
+
task._resampler = resampler
|
|
2331
2427
|
self._state.log_training_metric = log_training_metric
|
|
2332
2428
|
|
|
2333
2429
|
self._state.fit_kwargs = fit_kwargs
|
|
@@ -2340,7 +2436,6 @@ class AutoML(BaseEstimator):
|
|
|
2340
2436
|
if mlflow_logging is None
|
|
2341
2437
|
else mlflow_logging
|
|
2342
2438
|
)
|
|
2343
|
-
fit_kwargs_by_estimator = fit_kwargs_by_estimator or self._settings.get("fit_kwargs_by_estimator")
|
|
2344
2439
|
self._state.fit_kwargs_by_estimator = fit_kwargs_by_estimator.copy() # shallow copy of fit_kwargs_by_estimator
|
|
2345
2440
|
self._state.weight_val = sample_weight_val
|
|
2346
2441
|
self._mlflow_exp_name = mlflow_exp_name
|
|
@@ -7,6 +7,7 @@ import os
|
|
|
7
7
|
import random
|
|
8
8
|
import re
|
|
9
9
|
import uuid
|
|
10
|
+
import warnings
|
|
10
11
|
from datetime import datetime, timedelta
|
|
11
12
|
from decimal import ROUND_HALF_UP, Decimal
|
|
12
13
|
from typing import TYPE_CHECKING, Union
|
|
@@ -350,6 +351,17 @@ class DataTransformer:
|
|
|
350
351
|
X.insert(0, TS_TIMESTAMP_COL, ds_col)
|
|
351
352
|
if cat_columns:
|
|
352
353
|
X[cat_columns] = X[cat_columns].astype("category")
|
|
354
|
+
# Pin the per-column category list seen at fit time so
|
|
355
|
+
# `transform()` produces the same integer codes for the same
|
|
356
|
+
# values regardless of what is passed at predict time (see
|
|
357
|
+
# issue #1101). "__NAN__" is reserved as the sentinel slot
|
|
358
|
+
# used for values unseen at fit time.
|
|
359
|
+
self._cat_categories = {}
|
|
360
|
+
for col in cat_columns:
|
|
361
|
+
cats = list(X[col].cat.categories)
|
|
362
|
+
if "__NAN__" not in cats:
|
|
363
|
+
cats.append("__NAN__")
|
|
364
|
+
self._cat_categories[col] = cats
|
|
353
365
|
if num_columns:
|
|
354
366
|
X_num = X[num_columns]
|
|
355
367
|
try:
|
|
@@ -450,6 +462,30 @@ class DataTransformer:
|
|
|
450
462
|
X[column] = X[column].cat.add_categories("__NAN__").fillna("__NAN__")
|
|
451
463
|
if cat_columns:
|
|
452
464
|
X[cat_columns] = X[cat_columns].astype("category")
|
|
465
|
+
# Pin codes to the categories seen at fit time so they do not
|
|
466
|
+
# drift when the predict-time column has a different value
|
|
467
|
+
# distribution than the fit-time column (see issue #1101).
|
|
468
|
+
# Older pickles without `_cat_categories` fall back to
|
|
469
|
+
# whatever `astype("category")` inferred above.
|
|
470
|
+
saved_cats_map = getattr(self, "_cat_categories", None)
|
|
471
|
+
if saved_cats_map:
|
|
472
|
+
for column in cat_columns:
|
|
473
|
+
saved_cats = saved_cats_map.get(column)
|
|
474
|
+
if saved_cats is None:
|
|
475
|
+
continue
|
|
476
|
+
current = X[column].astype(object)
|
|
477
|
+
unseen_mask = ~current.isin(saved_cats) & current.notna()
|
|
478
|
+
if unseen_mask.any():
|
|
479
|
+
samples = sorted({str(v) for v in current[unseen_mask].unique()})[:5]
|
|
480
|
+
warnings.warn(
|
|
481
|
+
f"Column '{column}' contains values unseen at fit time "
|
|
482
|
+
f"(e.g. {samples}); these rows will be encoded as '__NAN__' "
|
|
483
|
+
"and predictions may be unreliable.",
|
|
484
|
+
UserWarning,
|
|
485
|
+
stacklevel=2,
|
|
486
|
+
)
|
|
487
|
+
current = current.where(~unseen_mask, "__NAN__")
|
|
488
|
+
X[column] = pd.Categorical(current, categories=saved_cats)
|
|
453
489
|
if num_columns:
|
|
454
490
|
X_num = X[num_columns].fillna(np.nan)
|
|
455
491
|
if self._drop:
|
|
@@ -388,7 +388,7 @@ def compute_estimator(
|
|
|
388
388
|
budget=budget,
|
|
389
389
|
log_training_metric=log_training_metric,
|
|
390
390
|
fit_kwargs=fit_kwargs,
|
|
391
|
-
free_mem_ratio=
|
|
391
|
+
free_mem_ratio=free_mem_ratio,
|
|
392
392
|
)
|
|
393
393
|
else:
|
|
394
394
|
val_loss, metric_for_logging, train_time, pred_time = task.evaluate_model_CV(
|
|
@@ -403,7 +403,7 @@ def compute_estimator(
|
|
|
403
403
|
cv_score_agg_func,
|
|
404
404
|
log_training_metric=log_training_metric,
|
|
405
405
|
fit_kwargs=fit_kwargs,
|
|
406
|
-
free_mem_ratio=
|
|
406
|
+
free_mem_ratio=free_mem_ratio,
|
|
407
407
|
)
|
|
408
408
|
|
|
409
409
|
if isinstance(estimator, TransformersEstimator):
|
|
@@ -448,6 +448,7 @@ def train_estimator(
|
|
|
448
448
|
fit_kwargs["metric"] = eval_metric
|
|
449
449
|
|
|
450
450
|
if X_train is not None:
|
|
451
|
+
X_train, y_train = _resample_training_data(X_train, y_train, task)
|
|
451
452
|
train_time = estimator.fit(X_train, y_train, budget=budget, free_mem_ratio=free_mem_ratio, **fit_kwargs)
|
|
452
453
|
else:
|
|
453
454
|
estimator = estimator.estimator_class(**estimator.params)
|
|
@@ -455,6 +456,16 @@ def train_estimator(
|
|
|
455
456
|
return estimator, train_time
|
|
456
457
|
|
|
457
458
|
|
|
459
|
+
def _resample_training_data(X_train, y_train, task):
|
|
460
|
+
resampler = getattr(task, "_resampler", None)
|
|
461
|
+
if resampler is None:
|
|
462
|
+
return X_train, y_train
|
|
463
|
+
|
|
464
|
+
from sklearn.base import clone
|
|
465
|
+
|
|
466
|
+
return clone(resampler).fit_resample(X_train, y_train)
|
|
467
|
+
|
|
468
|
+
|
|
458
469
|
def norm_confusion_matrix(y_true: Union[np.array, Series], y_pred: Union[np.array, Series]):
|
|
459
470
|
"""normalized confusion matrix.
|
|
460
471
|
|
|
@@ -525,6 +536,7 @@ def get_val_loss(
|
|
|
525
536
|
# fit_kwargs['groups_val'] = groups_val
|
|
526
537
|
# fit_kwargs['X_val'] = X_val
|
|
527
538
|
# fit_kwargs['y_val'] = y_val
|
|
539
|
+
X_train, y_train = _resample_training_data(X_train, y_train, task)
|
|
528
540
|
estimator.fit(X_train, y_train, budget=budget, free_mem_ratio=free_mem_ratio, **fit_kwargs)
|
|
529
541
|
val_loss, metric_for_logging, pred_time, _ = _eval_estimator(
|
|
530
542
|
config,
|