Reputation: 1498
I am working with sklearn.tree.DecisionTreeClassifier
here is the link to it.
I want to use the keyword criterion
and set it to "entropy"
I did the following :
model = DecisionTreeClassifier()
model.fit(X_train, y_train, criterion = "entropy")
but it gives this error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-103-509174b2caad> in <module>()
1 model = DecisionTreeClassifier()
----> 2 model.fit(X_train, y_train, criterion = "entropy")
TypeError: fit() got an unexpected keyword argument 'criterion'
It is working fine with the default argument 'gini'
but not with this.
Upvotes: 3
Views: 9641
Reputation: 8077
You probably want
model = DecisionTreeClassifier(criterion="entropy")
model.fit(X_train, y_train)
Upvotes: 4