gpt4 book ai didi

scikit-learn - sklearn 导入错误 - 导入错误 : cannot import name 'comb'

转载 作者:行者123 更新时间:2023-12-04 03:56:00 25 4
gpt4 key购买 nike

我正在尝试这样做:

from sklearn.model_selection import train_test_split

并得到一个错误:
In [31]: from sklearn.model_selection import train_test_split
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-31-73edc048c06b> in <module>()
----> 1 from sklearn.model_selection import train_test_split

/usr/local/lib/python3.6/site-packages/sklearn/model_selection/__init__.py in <module>()
----> 1 from ._split import BaseCrossValidator
2 from ._split import KFold
3 from ._split import GroupKFold
4 from ._split import StratifiedKFold
5 from ._split import TimeSeriesSplit

/usr/local/lib/python3.6/site-packages/sklearn/model_selection/_split.py in <module>()
29 from ..externals.six import with_metaclass
30 from ..externals.six.moves import zip
---> 31 from ..utils.fixes import signature, comb
32 from ..base import _pprint
33

ImportError: cannot import name 'comb'

任何帮助都会非常感激。

最佳答案

SciPy >=0.19 使用 from scipy.special import comb而不是 from scipy.misc import comb . https://github.com/scikit-learn/scikit-learn/pull/9046

utils/fixes.py source

try:  # SciPy >= 0.19
from scipy.special import comb, logsumexp
except ImportError:
from scipy.misc import comb, logsumexp # noqa

关于scikit-learn - sklearn 导入错误 - 导入错误 : cannot import name 'comb' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47151453/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com