导入sklearn.svm时,Sklearn会抛出错误“无法导入名称check_arrays”。
我搜索了这个问题,另一个问题表明check_arrays已被check_array替换。似乎旧的check_arrays被一些名为form svm的代码使用,这是sklearn.svm模块中的一个错误吗?
刚刚更新至0.17.1版。
Traceback:
File ".../main.py", line 4, in <module>
import sklearn.svm as svm
File "/usr/local/lib/python2.7/dist-packages/sklearn/svm/__init__.py", line 13, in <module>
from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC, \
File "/usr/local/lib/python2.7/dist-packages/sklearn/svm/classes.py", line 4, in <module>
from .base import _fit_liblinear, BaseSVC, BaseLibSVM
File "/usr/local/lib/python2.7/dist-packages/sklearn/svm/base.py", line 12, in <module>
from ..multiclass import _ovr_decision_function
File "/usr/local/lib/python2.7/dist-packages/sklearn/multiclass.py", line 44, in <module>
from .metrics.pairwise import euclidean_distances
File "/usr/local/lib/python2.7/dist-packages/sklearn/metrics/__init__.py", line 33, in <module>
from . import cluster
File "/usr/local/lib/python2.7/dist-packages/sklearn/metrics/cluster/__init__.py", line 21, in <module>
from .bicluster import consensus_score
File "/usr/local/lib/python2.7/dist-packages/sklearn/metrics/cluster/bicluster/__init__.py", line 1, in <module>
from .bicluster_metrics import consensus_score
File "/usr/local/lib/python2.7/dist-packages/sklearn/metrics/cluster/bicluster/bicluster_metrics.py", line 6, in <module>
from sklearn.utils.validation import check_arrays
ImportError: cannot import name check_arrays
答案 0 :(得分:0)
好的,问题就解决了。 Sklearn 0.17.1没有目录bicluster,而bicluster_metrics.py位于sklearn / metrics / cluster中(https://github.com/scikit-learn/scikit-learn/tree/0.17.1/sklearn/metrics/cluster)。
那只是一个不干净的安装。希望这有助于某人!