nltk - How to serialize a CObject in Python? -
i've trained svm classifier using nltk
, svmlight
python libraries , when call pickle.dump(my_classifier, outfile, 1)
save classifier, throws error:
file "/usr/lib/python2.7/pickle.py", line 313, in save (t.__name__, obj)) pickle.picklingerror: can't pickle 'pycobject' object: <pycobject object @ 0xc1cbd50>
i read can't pickle cobject
, didn't find solution save work though :/
how proceed? use python 2.7.3
for it's worth, know nltk
, works fine when pickle other classifiers maxentclassifier
or naivebayesclassifier
opposed svmclassifier
, think has svmlight
library, it's first time use it.
you can use method write_model(model, filename)
svmlight library save it. maybe can teach pickle use custom protocol pickling.
Comments
Post a Comment