What model do Word2Vec use by default?? Skip-gram or CBOW?

2,807 views
Skip to first unread message

Sulaiman Khan

unread,
Oct 2, 2016, 6:49:43 AM10/2/16
to gensim
Hello all. I am new here and wanted to using gensim library for thesis which is NLP(Bangla language) based. I need to implement skip gram model and train that and classify data. Previously i have used CBOW and using NGRam get a 87% accuracy on prediction with some 14k text data. Now wanna test skip gram. I searched google and read some blog. All say that word2vec has both CBOW and skip-gram model. I got confused there. What exactly word2vec use by default? Is it skip gram or cbow? Thanks in advance .

Lev Konstantinovskiy

unread,
Oct 2, 2016, 6:59:32 AM10/2/16
to gensim
Hi Sulaiman,

Default algo in Gensim is CBOW. It is used if you simply call gensim.models.Word2Vec(sentences)

In order to use skipgram run gensim.models.Word2Vec(sentences, sg=1)

See this tutorial for a word2vec example or see word2vec parameters in the code.

Regards
Lev

Sulaiman Khan

unread,
Oct 3, 2016, 6:02:41 AM10/3/16
to gen...@googlegroups.com
How can i obtain the vector(using skip-gram) in a list or any other data structure like numpy? can yo send me any example code? it will be a great help for me. I usually use scikit-learn library class. I am new here trying to use it but having a great problem adjusting using it. I wanna get skip gram vector then train that model in scikit-learn svm and classify data . Thanks for your reply

--
You received this message because you are subscribed to a topic in the Google Groups "gensim" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gensim/neDSgepSpCk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gensim+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sulaiman Khan

unread,
Oct 3, 2016, 6:05:57 AM10/3/16
to gen...@googlegroups.com
One more question, can i get skip-gram vector from Doc2Vec?? i have found a sample code where this man use Doc2Vec and after that train that vector with scikitr learn??? here is the link http://linanqiu.github.io/2015/10/07/word2vec-sentiment/

Lev Konstantinovskiy

unread,
Oct 3, 2016, 6:06:05 AM10/3/16
to gensim
Hi Sulaiman,

These two tutorials are quite useful. Please let me know how you find them.



Regards
Lev
Reply all
Reply to author
Forward
0 new messages