title: Python SkLearn: ValueError: Found input variables with inconsistent numbers samples: [1173, 294]
body: <p>I do know that I am assigning the test and training x and y variables correctly during train_test_split. However, I used a TfidfVectorizer for x and a MultiLabelBinarizer for y, with X and Y ending up with different dimensions. Thus, I get the following error:</p>
  
  <blockquote>
    <p>ValueError: Found input variables with inconsistent numbers of
    samples: [1173, 294]</p>
  </blockquote>
  
  <p>I haven't figured out a way to make the input and target have the same dimensions.
  Below is my code:</p>
  
  <pre><code>xTrain, xTest, yTrain, yTest = train_test_split(x, y, test_size=0.20)
  
  nb_clf = MultinomialNB()
  sgd = SGDClassifier()
  lr = LogisticRegression()
  mn = MultinomialNB()
  
  xTrain = csr_matrix(xTrain).toarray()
  xTest = csr_matrix(xTest).toarray()
  yTrain = csr_matrix(yTrain).toarray()
  
  print("xTrain.shape = " + str(xTrain.shape))
  print("xTest.shape = " + str(xTest.shape))
  print("yTrain.shape = " + str(yTrain.shape))
  print("yTest.shape = " + str(yTest.shape))
  
  for classifier in [nb_clf, sgd, lr, mn]:
      clf = MultiOutputRegressor(classifier)
      clf.fit(xTrain.astype("U"), xTest.astype("U"))
      y_pred = clf.predict(yTest)
      print("\ny_pred:")
      print(y_pred)
  </code></pre>
  
  <p>Below is the output from the print statements:</p>
  
  <pre><code>xTrain.shape = (1173, 13725)
  xTest.shape = (294, 13725)
  yTrain.shape = (1173, 28)
  yTest.shape = (294, 28)
  </code></pre>