No, SGDClassifier
does not do multilabel classification -- it does multiclass classification, which is a different problem, although both are solved using a one-vs-all problem reduction.
Then, neither SGD nor OneVsRestClassifier.fit
will accept a sparse matrix for y
. The former wants an array of labels, as you've already found out. The latter wants, for multilabel purposes, a list of lists of labels, e.g.
y = [[1], [2, 3], [1, 3]]
to denote that X[0]
has label 1, X[1]
has labels {2,3}
and X[2]
has labels {1,3}
.