pycaret.time_series.TSForecastingExperiment ImportError:无法从“sklearn.model_selection._search”导入名称“_check_param_grid”

nik*_*kn8 5 python azure-databricks pycaret sktime

在 databricks 中导入Pycaret time-series(beta)模块时,我收到以下错误(我们之前运行成功)。请求您帮助解决问题。

\n

使用中的 pycaret 版本:

\n
import pycaret\npycaret.__version__  # Out[1]: '3.0.0'\n
Run Code Online (Sandbox Code Playgroud)\n

使用的python版本:

\n
import sys\nsys.version #Out[9]: '3.8.10 (default, Mar 15 2022, 12:22:08) \\n[GCC 9.4.0]'\n
Run Code Online (Sandbox Code Playgroud)\n

以下是该问题的堆栈跟踪。

\n
from pycaret.time_series import TSForecastingExperiment\n\n/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py in import_patch(name, globals, locals, fromlist, level)\n    160             # Import the desired module. If you\xe2\x80\x99re seeing this while debugging a failed import,\n    161             # look at preceding stack frames for relevant error information.\n--> 162             original_result = python_builtin_import(name, globals, locals, fromlist, level)\n    163 \n    164             is_root_import = thread_local._nest_level == 1\n\n/databricks/python/lib/python3.8/site-packages/pycaret/time_series/__init__.py in <module>\n----> 1 from pycaret.time_series.forecasting.oop import TSForecastingExperiment\n      2 from pycaret.time_series.forecasting.functional import (\n      3     setup,\n      4     create_model,\n      5     compare_models,\n\n/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py in import_patch(name, globals, locals, fromlist, level)\n    160             # Import the desired module. If you\xe2\x80\x99re seeing this while debugging a failed import,\n    161             # look at preceding stack frames for relevant error information.\n--> 162             original_result = python_builtin_import(name, globals, locals, fromlist, level)\n    163 \n    164             is_root_import = thread_local._nest_level == 1\n\n/databricks/python/lib/python3.8/site-packages/pycaret/time_series/forecasting/oop.py in <module>\n     14 from sklearn.base import clone\n     15 from sktime.forecasting.base import ForecastingHorizon\n---> 16 from sktime.forecasting.model_selection import (\n     17     temporal_train_test_split,\n     18     ExpandingWindowSplitter,\n\n/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py in import_patch(name, globals, locals, fromlist, level)\n    160             # Import the desired module. If you\xe2\x80\x99re seeing this while debugging a failed import,\n    161             # look at preceding stack frames for relevant error information.\n--> 162             original_result = python_builtin_import(name, globals, locals, fromlist, level)\n    163 \n    164             is_root_import = thread_local._nest_level == 1\n\n/databricks/python/lib/python3.8/site-packages/sktime/forecasting/model_selection/__init__.py in <module>\n     20 from sktime.forecasting.model_selection._split import SlidingWindowSplitter\n     21 from sktime.forecasting.model_selection._split import temporal_train_test_split\n---> 22 from sktime.forecasting.model_selection._tune import ForecastingGridSearchCV\n     23 from sktime.forecasting.model_selection._tune import ForecastingRandomizedSearchCV\n\n/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py in import_patch(name, globals, locals, fromlist, level)\n    160             # Import the desired module. If you\xe2\x80\x99re seeing this while debugging a failed import,\n    161             # look at preceding stack frames for relevant error information.\n--> 162             original_result = python_builtin_import(name, globals, locals, fromlist, level)\n    163 \n    164             is_root_import = thread_local._nest_level == 1\n\n/databricks/python/lib/python3.8/site-packages/sktime/forecasting/model_selection/_tune.py in <module>\n     11 from sklearn.base import clone\n     12 from sklearn.model_selection import ParameterGrid, ParameterSampler, check_cv\n---> 13 from sklearn.model_selection._search import _check_param_grid\n     14 from sklearn.utils.metaestimators import if_delegate_has_method\n
Run Code Online (Sandbox Code Playgroud)\n

Nik*_*pta 7

这是由于在 sktime 依赖项中使用了 sklearn 的私有方法。自从 sklearn 更新到 1.1.0 以来,这个私有方法被删除/移动,因此它被破坏了。sktime 团队正在努力解决这个问题。同时,您可以通过强制安装 sklearn 1.0.2 来修复此问题。

请参阅 GitHub 存储库中的详细信息:https ://github.com/pycaret/pycaret/issues/2542