title: ValueError: bad input shape (100, 752)
body: <p>I'm trying to run naive bayes model using scikit however it's giving me this error and I can't seem to figure out what the problem is? </p>
  
  <pre><code># Gaussian Naive Bayes
  from sklearn import datasets
  from sklearn import metrics
  from sklearn.naive_bayes import GaussianNB
  # load the iris datasets
  #dataset = datasets.load_iris()
  # fit a Naive Bayes model to the data
  model = GaussianNB()
  model.fit(training_set, testing_set)
  print(model)
  # make predictions
  expected = testing_set
  predicted = model.predict(training_set)
  # summarize the fit of the model
  print(metrics.classification_report(expected, predicted))
  print(metrics.confusion_matrix(expected, predicted))
  </code></pre>
  
  <p>I think the problem is in training_set and testing_set but I'm not sure and don't know how to solve it, I have split the data in training and testing </p>
  
  <pre><code>training_set=newdf.sample(frac=0.7,random_state=200)
  testing_set=newdf.drop(train.index)
  </code></pre>
  
  <p>The code works fine if I I use iris data </p>
  
  <pre><code># Gaussian Naive Bayes
  from sklearn import datasets
  from sklearn import metrics
  from sklearn.naive_bayes import GaussianNB
  # load the iris datasets
  dataset = datasets.load_iris()
  # fit a Naive Bayes model to the data
  model = GaussianNB()
  model.fit(dataset.data, dataset.target)
  print(model)
  # make predictions
  expected = dataset.target
  predicted = model.predict(dataset.data)
  # summarize the fit of the model
  print(metrics.classification_report(expected, predicted))
  print(metrics.confusion_matrix(expected, predicted))
  </code></pre>
  
  <p>How can I remove this error?</p>
  
  <pre><code>Traceback
  
  ---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-77-072d1f083190&gt; in &lt;module&gt;()
        7 # fit a Naive Bayes model to the data
        8 model = GaussianNB()
  ----&gt; 9 model.fit(training_set, testing_set)
       10 print(model)
       11 # make predictions
  
  D:\python\lib\site-packages\sklearn\naive_bayes.py in fit(self, X, y, sample_weight)
      171             Returns self.
      172         """
  --&gt; 173         X, y = check_X_y(X, y)
      174         return self._partial_fit(X, y, np.unique(y), _refit=True,
      175                                  sample_weight=sample_weight)
  
  D:\python\lib\site-packages\sklearn\utils\validation.pyc in check_X_y(X, y, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, multi_output, ensure_min_samples, ensure_min_features, y_numeric, warn_on_dtype, estimator)
      513                         dtype=None)
      514     else:
  --&gt; 515         y = column_or_1d(y, warn=True)
      516         _assert_all_finite(y)
      517     if y_numeric and y.dtype.kind == 'O':
  
  D:\python\lib\site-packages\sklearn\utils\validation.pyc in column_or_1d(y, warn)
      549         return np.ravel(y)
      550 
  --&gt; 551     raise ValueError("bad input shape {0}".format(shape))
      552 
      553 
  
  ValueError: bad input shape (100, 752)
  </code></pre>