title: Convert a (n_samples, n_features) ndarray to a (n_samples, 1) array of vectors to use as training labels for an sklearn SVM
body: <p>I'm trying to calculate the ROC and AUC for an SVM model I'm building. I'm following the code from <a href="http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html" rel="nofollow noreferrer">this sklearn example</a>. One of the requirements is that the output labels <code>y</code> need to be binarized. I do this by using creating a <code>MultiLabelBinarizer</code> and encode all the labels, which works fine. However, this creates a (n_samples, n_features) ndarray. The <code>classifier.fit(X, y)</code> function assumes <code>y.shape = (n_samples)</code>. I want to essentially "smush" the columns of <code>y</code> together, so that y[0][0] would return the entire feature-vector, <code>V</code>, instead of just the first value of <code>V</code>.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>    enc = MultiLabelBinarizer()
      print("Encoding data...")
      # Fit the encoder onto all possible data values
      print(pandas.DataFrame(enc.fit_transform(df["present"] + df["member"].apply(str).apply(lambda x: [x])),
                             columns=enc.classes_, index=df.index))
      X, y = enc.transform(df["present"]), list(df["member"].apply(str))
      print("Training svm...")
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.5, random_state=0)
      y_train = enc.transform([[x] for x in y_train])  # Strings to 1HotVectors
      svc = svm.SVC(C=1.1, kernel="linear", probability=True, class_weight='balanced')
      svc.fit(X_train, y_train)  # y_train should be 1D but isn't
  </code></pre>
  
  <p>The exception I get is:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/SawyerPC/PycharmProjects/DiscordSocialGraph/encode_and_train.py", line 129, in &lt;module&gt;
      enc, clf, split_data = encode_and_train(df)
    File "C:/Users/SawyerPC/PycharmProjects/DiscordSocialGraph/encode_and_train.py", line 57, in encode_and_train
      svc.fit(X_train, y_train)  # TODO y_train needs to be flattened to (n_samples,)
    File "C:\Users\SawyerPC\Anaconda3\lib\site-packages\sklearn\svm\base.py", line 149, in fit
      X, y = check_X_y(X, y, dtype=np.float64, order='C', accept_sparse='csr')
    File "C:\Users\SawyerPC\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 547, in check_X_y
      y = column_or_1d(y, warn=True)
    File "C:\Users\SawyerPC\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 583, in column_or_1d
      raise ValueError("bad input shape {0}".format(shape))
  ValueError: bad input shape (5000, 10)
  </code></pre>