title: Bringing a classifier to production
body: <p>I've saved my classifier pipeline using  joblib: </p>
  
  <pre><code>vec = TfidfVectorizer(sublinear_tf=True, max_df=0.5, ngram_range=(1, 3))
  pac_clf = PassiveAggressiveClassifier(C=1)
  vec_clf = Pipeline([('vectorizer', vec), ('pac', pac_clf)])
  vec_clf.fit(X_train,y_train)
  joblib.dump(vec_clf, 'class.pkl', compress=9)
  </code></pre>
  
  <p>Now i'm trying to use it in a production env:</p>
  
  <pre><code>def classify(title):
  
    #load classifier and predict
    classifier = joblib.load('class.pkl')
  
    #vectorize/transform the new title then predict
    vectorizer = TfidfVectorizer(sublinear_tf=True, max_df=0.5, ngram_range=(1, 3))
    X_test = vectorizer.transform(title)
    predict = classifier.predict(X_test)
    return predict
  </code></pre>
  
  <p>The error i'm getting is: ValueError: Vocabulary wasn't fitted or is empty!
  I guess i should load the Vocabulary from te joblid but i can't get it to work</p>