ImportError: cannot import name 'GaussianProcess' from 'sklearn.gaussian_process'

ImportError: cannot import name 'GaussianProcess' from 'sklearn.gaussian_process'

我正在尝试 kaggle Bayesian Hyperparam Optimization of RF 的内核。而且我无法导入 sklearn.gaussian_process.GaussianProcess。请帮助这个可怜的 scikit-learn 新手。

from sklearn.gaussian_process import GaussianProcess as GP

错误:

Traceback (most recent call last):
  File "C:/Users/Develop/PycharmProjects/reinforcement recommandation system/BNP/bayesianoptimization-of-random-forest.py", line 24, in <module>
    from sklearn.gaussian_process import GaussianProcess as GP
ImportError: cannot import name 'GaussianProcess' from 'sklearn.gaussian_process' (C:\Users\Develop\PycharmProjects\reinforcement recommandation system\lib\site-packages\sklearn\gaussian_process\__init__.py)

Process finished with exit code 1

取决于您是否需要回归器或分类器:

from sklearn.gaussian_process import GaussianProcessRegressor as GP

from sklearn.gaussian_process import GaussianProcessClassifier as GP

另外,看看不同的 modules

看来还是得用老的scikit-learn version 0.15-git

sklearn.gaussian_process.GaussianProcess 的文档位于此处: https://scikit-learn.org/0.15/modules/generated/sklearn.gaussian_process.GaussianProcess.html

我刚刚遇到了同样的问题,但我会继续尝试了解当前版本 scikit-learn 1.0.2 中的 sklearn.gaussian_process.GaussianProcessRegressor 是否适合我的目的。