I am trying to classify data into four different labels. The training data looks something like:
[
[[0.1 , 0.6, 0.0, 0.3], 1, 10, 0, 0, 0],
[[0.7 , 0.3, 0.0, 0.0], 0, 7, 22, 0, 0],
[[0.0 , 0.0, 0.6, 0.4], 0, 0, 6, 0, 20],
...
]
Each row is an instance. First column contains the labels. Columns 2..n
contain the features.
I am trying to understand how to train a multilabel classifier using SciKit OneVsRestClassifier but I just don't get how I must proceed in the code.
I have been able to do single-label classification for this dataset replacing the first column with a single value (eg. the first instance would map completely to the second label) but I would like the more nuanced multi-label output. This is what I use for the single label classifier (assuming above dataset):
labels = [1,0,3, ...]
data = [[1, 10, 0, 0, 0], [0, 7, 22, 0, 0], [0, 0, 6, 0, 20], ...]
clf = svm.SVC(kernel='poly')
clf.fit(data, labels)
Any idea how to convert this to multi-labels?
Thanks!