[scikit-learn] Problem found when testing DecisionTreeClassifier within the source folder
hanzi mao
hzmao at hotmail.com
Mon Sep 4 22:42:40 EDT 2017
Hi,
I am researching on the source code of DecisionTree recently. Here are the things I tried.
1. Downloaded source code from github.
2. run "python setup.py build_ext --inplace" to compile the sources in the unzipped source folder.
3. Try the following codes to see whether it works. Here I changed the name of the sklearn folder to sklearn1 to differentiate it from the one installed.
>>> from sklearn1 import tree
>>> from sklearn.datasets import load_iris
>>> iris = load_iris()
>>> clf = tree.DecisionTreeClassifier()
>>> clf = clf.fit(iris.data, iris.target)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sklearn1\tree\tree.py", line 790, in fit
X_idx_sorted=X_idx_sorted)
File "sklearn1\tree\tree.py", line 341, in fit
self.presort)
TypeError: Argument 'criterion' has incorrect type (expected sklearn.tree._criterion.Criterion, got sklearn.tree._criterion.Gini)
Then a weird error happened. Actually I also tried the newest stable version of scikit-learn earlier today. It had the same error. So I was thinking maybe try the newest version in github might help. Unlikely, it didn't.
I have limited knowledge about the source code of scikit-learn. I am wondering if anyone could help me with this.
Thanks!
Best,
Hanna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20170905/05046184/attachment.html>
More information about the scikit-learn
mailing list