from sklearn import tree
features = [[140, 1], [130, 1], [150, 0], [170, 0]] # 1- smooth 0 - bumpy
labels = [0, 0, 1, 1] # 0 - apple 1 - orange
clf = tree.DecisionTreeClassifier()
clf = clf.fit(features, labels)
print (clf.predict([[150, 0]]))
What I wanted is to make a simple first machine learning application which tells me if the fruit is an orange or an apple. After run it shows me this:
Traceback (most recent call last):
File "C:/Users/ursac/Desktop/hello world.py", line 1, in <module>
from sklearn import tree
File "C:\Users\ursac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\__init__.py", line 134, in <module>
from .base import clone
File "C:\Users\ursac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\base.py", line 11, in <module>
from scipy import sparse
ModuleNotFoundError: No module named 'scipy'
but i have already install sklearn with pip install sklearn
in the cmd
Please help me. Thank you !
Try to install scipy
, since it complains about that module missing.
pip install scipy
It installs scipy
/numpy
. As a side note - if someone has old, and new python - then pip3
should be used, since pip
installs modules for python 2 in this case.