Reputation: 6764
Can I fit the classifier with binary and multiclass labels to predict a result?
Multiclass labels can have more then 2 values, binary labels only can have 2.
Example (the first parameter in X is multiclass, the second is binary - [-1,1]):
from sklearn import tree
X = [[0, -1], [2, 1], [1, -1] ]
Y = [0, 1, 1]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(X, Y)
clf.predict([[1, 1]])
Upvotes: 0
Views: 320
Reputation: 1977
I think you are confusing labels (usually represented with Y
variable as you also do in your example) with features (the matrix X
in your example). When talking about binary or multiclass labels, it's the output/response variable Y
that is usually meant.
The input variables (values in matrix X
) can be arbitrary integers or floats, so your example is perfectly valid.
Upvotes: 2