title: Scikit-learn multi-label classification
body: <p>I am trying to learn about multi-label classification of texts using Scikit-learn, I am attempting to adapt one of the initial example tutorials which comes with scikit for the classification of languages using wikipedia articles as training data. I am trying to implement this below but the code still returns a single label for each where I would expect the last prediction to return fr, en</p>
  
  <p>Could anyone advice on the correct way to enable multi-label classification.</p>
  
  <pre><code>import sys
  
  from sklearn.feature_extraction.text import TfidfVectorizer
  from sklearn.feature_extraction.text import CountVectorizer
  from sklearn.feature_extraction.text import TfidfTransformer
  from sklearn.datasets import make_multilabel_classification
  from sklearn.preprocessing import LabelBinarizer
  
  from sklearn.svm import LinearSVC
  from sklearn.pipeline import Pipeline
  from sklearn.datasets import load_files
  from sklearn.cross_validation import train_test_split
  from sklearn import metrics
  from sklearn.multiclass import OneVsRestClassifier
  #change model_selection to cross_validation
  
  # The training data folder must be passed as first argument - This uses the example wiki language data files
  languages_data_folder = sys.argv[1]
  dataset = load_files(languages_data_folder)
  
  # Split the dataset in training and test set:
  docs_train, docs_test, y_train, y_test = train_test_split(
  dataset.data, dataset.target, test_size=0.5)
  
  
  #pipeline
  clf = Pipeline([
  ('vectorizer', CountVectorizer(ngram_range=(1,2))),
  ('tfidf', TfidfTransformer()),
  ('clf', OneVsRestClassifier(LinearSVC())),
  ])
      target_names=dataset.target_names
  
  
  
  # TASK: Fit the pipeline on the training set
  clf.fit(docs_train, y_train)
  
  # TASK: Predict the outcome on the testing set in a variable named y_predicted
  y_predicted = clf.predict(docs_test)
  
  print target_names
  
  
  # Predict the result on some short new sentences:
  sentences = [
      u'This is a language detection test.',
      u'Ceci est un test de d\xe9tection de la langue.',
      u'Dies ist ein Test, um die Sprache zu erkennen.',
      u'Bonjour Mon ami. This is a language detection test.',
  
  ]
  predicted = clf.predict(sentences)
  
  for s, p in zip(sentences, predicted):
      print(u'The language of "%s" is "%s"' % (s, target_names[p]))
  </code></pre>
  
  <p>Returns - </p>
  
  <p>The language of "This is a language detection test." is "en"</p>
  
  <p>The language of "Ceci est un test de détection de la langue." is "fr"</p>
  
  <p>The language of "Dies ist ein Test, um die Sprache zu erkennen." is "de"</p>
  
  <p>The language of "Bonjour Mon ami. This is a language detection test." is "en"</p>