Model Dumping Pickle
subhabrata.banerji at gmail.com
subhabrata.banerji at gmail.com
Sat May 30 08:14:19 EDT 2015
Dear Group,
If I use pickle to dump my model as follows,
>>> from gensim.models import Word2Vec
>>> from nltk.corpus import brown, movie_reviews, treebank
>>> b = Word2Vec(brown.sents())
>>> import pickle
>>> f = open('my_classifier5.pickle', 'wb')
>>> pickle.dump(b, f)
>>> f.close()
>>> f1= open('my_classifier5.pickle')
>>> classifier=pickle.load(f1)
>>> classifier.most_similar('money', topn=5)
[('pay', 0.6861867904663086), ('ready', 0.6255729794502258), ('try', 0.6118115186691284), ('go', 0.609034538269043), ('oppose', 0.6002943515777588)]
>>> f1.close()
Am I going fine? If any one may kindly suggest.
I am using Python 2.7 on MS-Windows 7 Professional.
Apology for any indentation error.
Regards,
Subhabrata Banerjee.
More information about the Python-list
mailing list