Reputation: 31
(1) Running Windows 8 (2) Downloaded and installed, Anaconda for Windows, PYTHON 2.7
(3) From Anaconda Prompt:
conda install scikit-learn
Fetching package metadata: ....
Solving package specifications: .....................
All requested packages already installed.
packages in environment at C:\Users\Joey\Anaconda2:
scikit-learn 0.17 np110py27_1
(4) Launched Spyder
(5) This is ok, and package is found.
import sklearn
(6) Tab completion (in Spyder) for sklearn, shows:
sklearn.base
sklearn.clone
sklearn.externals
sklearn.re
sklearn.setup_module
sklearn.sys
sklearn.utils
sklearn.warnings
(6) Therefore, when running a snippet as found in http://scikit-learn.org/stable/ example.
from sklearn import DecisionTreeRegressor
Traceback (most recent call last):
File "<ipython-input-2-5aa62260685f>", line 1, in <module>
from sklearn import DecisionTreeRegressor
ImportError: cannot import name DecisionTreeRegressor
(7) Earlier, I noticed the same behavior using Enthought Canopy and also couldn't get scikit to work there either. As a result, I uninstalled every Python program and IDE I could find to try and clean my system before attempting Anaconda, as described above. I looked at many other posts and still could not get my system to work properly and suspect there's path, library, or version issue.
Upvotes: 3
Views: 10274
Reputation: 11
decision tree algorithm is a module under Sklearn.tree Try and import it in this manner, it should work
from sklearn.tree import DecisionTreeRegressor
Upvotes: 1
Reputation: 351
scikit-learn is well documented. Here is the link for the documentation.
Upvotes: 0
Reputation: 2849
Right way is:
from sklearn.tree import DecisionTreeRegressor
sklearn.version = 0.17
Upvotes: 9