I am try DecisionTreeClassifier with parameters in a string.
print d # d= 'max_depth=100'
clf = DecisionTreeClassifier(d)
clf.fit(X[:3000,], labels[:3000])
I am getting below error for this case. If I use clf = DecisionTreeClassifier(max_depth=100)
it works fine.
Traceback (most recent call last):
File "train.py", line 120, in <module>
grid_search_generalized(X, labels, {"max_depth":[i for i in range(100, 200)]})
File "train.py", line 51, in grid_search_generalized
clf.fit(X[:3000,], labels[:3000])
File "/usr/local/lib/python2.7/dist-packages/sklearn/tree/tree.py", line 790, in fit
X_idx_sorted=X_idx_sorted)
File "/usr/local/lib/python2.7/dist-packages/sklearn/tree/tree.py", line 326, in fit
criterion = CRITERIA_CLF[self.criterion](self.n_outputs_,
KeyError: 'max_depth=100'