So I'm trying out machine learning, and following a tutorial I found online.
For some reason when I run my code numpy is giving me an error, even-though I am not importing that library. (I've been having problems with numpy)
Code:
#!/usr/bin/env python
from sklearn import tree
#1 = smooth 0 = bumpy
features = [[140, 1], [130, 1], [150, 0], [170, 0]] #input
labels = ["apple", "apple", "orange", "orange"] #desired output
#0 = apple 1 = orange
clf = tree.DecisionTreeClassifier()
clf = clf.fit(features, labels)
print clf.predict([[160, 0]])
Error:
C:\Windows\system32\cmd.exe /c (python ^<C:\Users\me\AppData\Local\Temp\22\V
Ii532A.tmp)
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "E:\Python27\lib\site-packages\sklearn\__init__.py", line 134, in <module
>
from .base import clone
File "E:\Python27\lib\site-packages\sklearn\base.py", line 9, in <module>
import numpy as np
File "E:\Python27\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "E:\Python27\lib\site-packages\numpy\add_newdocs.py", line 13, in <module
>
from numpy.lib import add_newdoc
File "E:\Python27\lib\site-packages\numpy\lib\__init__.py", line 8, in <module
>
from .type_check import *
File "E:\Python27\lib\site-packages\numpy\lib\type_check.py", line 11, in <mod
ule>
import numpy.core.numeric as _nx
File "E:\Python27\lib\site-packages\numpy\core\__init__.py", line 21, in <modu
le>
from . import function_base
File "E:\Python27\lib\site-packages\numpy\core\function_base.py", line 7, in <
module>
from .numeric import (result_type, NaN, shares_memory, MAY_SHARE_BOUNDS,
ImportError: cannot import name shares_memory
shell returned 1
Hit any key to close this window...
Thanks
P.S. Also looking for a couple tutorial suggestions, one with machine learning and NLP would be great