Hi,

I am using the below to pickle CountVectorizer

vectorizer = 
CountVectorizer(tokenizer=extract_features_sk,lowercase=self.lowercase,binary=self.is_binary)
output = open(self.fn_vec , 'wb')
pickle.dump(vectorizer, output)
output.close()

If I load the pickle in the same app, all works.  If I load in a
different app, I get the below even all required libraries and
functions are included in the new app.

So...does it make sense to pickel CountVectorizer?  I just did not
want to fit CountVectorizer every time I wanted to score a svm model.

Traceback (most recent call last):
  File "/home/ubuntu/workspace/tango/solariat_nlp/src/solariat_nlp/__init__.py",
line 12, in <module>
    from solariat_nlp.train import extract_features, create_vector, predict
  File "/home/ubuntu/workspace/tango/solariat_nlp/src/solariat_nlp/__init__.py",
line 183, in <module>
    cf.load_vector()
  File 
"/home/ubuntu/workspace/tango/solariat_nlp/src/solariat_nlp/scikitssvm/svm_class.py",
line 177, in load_vector
    self.vectorizer = pickle.load(pkl_file)
  File "/usr/lib/python2.6/pickle.py", line 1370, in load
    return Unpickler(file).load()
  File "/usr/lib/python2.6/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/lib/python2.6/pickle.py", line 1090, in load_global
    klass = self.find_class(module, name)
  File "/usr/lib/python2.6/pickle.py", line 1126, in find_class
    klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'extract_features_sk'

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to