我试图使用崇高的文字来运行此python代码脚本:
from sklearn import tree
clf = tree.DecisionTreeClassifier()
# CHALLENGE - create 3 more classifiers...
# 1
# 2
# 3
# [height, weight, shoe_size]
X = [[181, 80, 44], [177, 70, 43], [160, 60, 38], [154, 54, 37], [166, 65, 40],
[190, 90, 47], [175, 64, 39],
[177, 70, 40], [159, 55, 37], [171, 75, 42], [181, 85, 43]]
Y = ['male', 'male', 'female', 'female', 'male', 'male', 'female', 'female',
'female', 'male', 'male']
# CHALLENGE - ...and train them on our data
clf = clf.fit(X, Y)
prediction = clf.predict([[190, 70, 43]])
# CHALLENGE compare their reusults and print the best one!
print(prediction)
并出现以下错误:
Traceback (most recent call last):
File "E:\Machine Learning\Heloow.py", line 1, in <module>
from sklearn import tree
File "C:\Users\Kodok Lunak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sklearn\__init__.py", line 76, in <module>
from .base import clone
File "C:\Users\Kodok Lunak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sklearn\base.py", line 16, in <module>
from .utils import _IS_32BIT
File "C:\Users\Kodok Lunak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sklearn\utils\__init__.py", line 13, in <module>
from scipy.sparse import issparse
File "C:\Users\Kodok Lunak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\sparse\__init__.py", line 230, in <module>
from .csr import *
File "C:\Users\Kodok Lunak\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\sparse\csr.py", line 13, in <module>
from ._sparsetools import (csr_tocsc, csr_tobsr, csr_count_blocks,
ImportError: DLL load failed: The specified module could not be found.
我尝试了一些解决方案,例如重新安装sci-kit learning,numpy或scipy。还检查了环境变量只是为了确保存在python文件和python脚本的路径,并且一切看起来都不错。我不知道是什么原因造成的,非常感谢你们的任何帮助,谢谢..:)