title: save and reuse TfidfVectorizer using pickle raises error
body: <p>I am having trouble saving my vectorizer and using it in a different script. </p>
  
  <p>tokenize is a custom function</p>
  
  <p>ngram_range = (1,3)</p>
  
  <p>max_features = 5000</p>
  
  <p>Here is where I save it:</p>
  
  <pre><code>vectorizer = TfidfVectorizer(tokenizer=tokenize, ngram_range=ngram_range, max_features=max_features)
  
  X_train = vectorizer.fit_transform(X_train['text'])
  
  pickle.dump(vectorizer, open('tfidf_vectorizer.p', 'wb'))
  </code></pre>
  
  <p>Here is where I load it and try to use it (data_list is a dictionary):</p>
  
  <pre><code>vectorizer = TfidfVectorizer(pickle.load(open('tfidf_vectorizer.p', 'rb')))
  # this also causes the same error
  # vectorizer = pickle.load(open('tfidf_vectorizer.p', 'rb'))
  for x, art in enumerate(data_list):
      art['originalText'] = vectorizer.transform(art['originalText'])
  </code></pre>
  
  <p>And my error is:</p>
  
  <pre><code>AttributeError: Can't get attribute 'tokenize' on &lt;module '__main__' from 'C:/.....file where I load and use......'&gt;
  </code></pre>
  
  <p>Using the packages sklearn and pickle.</p>