title: sci-kit learn: Reshape your data either using X.reshape(-1, 1)
body: <p>I'm training a python (2.7.11) classifier for text classification and while running I'm getting a deprecated warning message that I don't know which line in my code is causing it! The error/warning. However, the code works fine and give me the results...</p>
  
  <blockquote>
    <p>\AppData\Local\Enthought\Canopy\User\lib\site-packages\sklearn\utils\validation.py:386: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>def main():
      data = []
      folds = 10
      ex = [ [] for x in range(0,10)]
      results = []
      for i,f in enumerate(sys.argv[1:]):
          data.append(csv.DictReader(open(f,'r'),delimiter='\t'))
      for f in data:       
          for i,datum in enumerate(f):
              ex[i % folds].append(datum)
      #print ex
      for held_out in range(0,folds):
          l = []
          cor = []
          l_test = []
          cor_test = []
          vec = []
          vec_test = []
  
          for i,fold in enumerate(ex):
              for line in fold:
                  if i == held_out:
                      l_test.append(line['label'].rstrip("\n"))
                      cor_test.append(line['text'].rstrip("\n"))
                  else:
                      l.append(line['label'].rstrip("\n"))
                      cor.append(line['text'].rstrip("\n"))
  
          vectorizer = CountVectorizer(ngram_range=(1,1),min_df=1)
          X = vectorizer.fit_transform(cor)
          for c in cor:        
              tmp = vectorizer.transform([c]).toarray()
              vec.append(tmp[0])
          for c in cor_test:        
              tmp = vectorizer.transform([c]).toarray()
              vec_test.append(tmp[0])
  
          clf = MultinomialNB()
          clf .fit(vec,l)
          result = accuracy(l_test,vec_test,clf)
          print result
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>Any idea which line raises this warning?
  Another issue is that running this code with different data sets gives me the same exact accuracy, and I can't figure out what causes this?
  If I want to use this model in another python process, I looked at the documentation and I found an example of using pickle library, but not for joblib. So, I tried following the same code, but this gave me errors:</p>
  
  <pre><code>clf = joblib.load('model.pkl') 
  pred = clf.predict(vec);
  </code></pre>
  
  <p>Also, if my data is CSV file with this format: "label \t text \n"
  what should be in the label column in test data?</p>
  
  <p>Thanks in advance</p>