i am trying to use scikit learn 0.17 with anaconda 2.7 for a multilabel classification problem. here is my code
import pandas as pd
import pickle
import re
from
The documents give this example:
>>> from sklearn.preprocessing import MultiLabelBinarizer
>>> y = [[2, 3, 4], [2], [0, 1, 3], [0, 1, 2, 3, 4], [0, 1, 2]]
>>> MultiLabelBinarizer().fit_transform(y)
array([[0, 0, 1, 1, 1],
[0, 0, 1, 0, 0],
[1, 1, 0, 1, 0],
[1, 1, 1, 1, 1],
[1, 1, 1, 0, 0]])
MultiLabelBinarizer.fit_transform
takes in your labeled sets and can output the binary array. The output should then be alright to pass to your fit function.