how to know vectors dimension in word2vec model

3,807 views
Skip to first unread message

David Batista

unread,
Dec 23, 2014, 10:37:31 AM12/23/14
to gen...@googlegroups.com
Hello everyone,

I'm doing a few experiments using models of different dimensions created with the word2vec tool by Mikolov.

Is there a way to know the number of dimensions of each model?
I looked through the API and code but did not find anything (maybe I miss something)

Thank you,
David


Radim Řehůřek

unread,
Dec 28, 2014, 2:34:01 PM12/28/14
to gen...@googlegroups.com
Hi David,

if you mean in the model file -- the number of dimensions is on the first line = the header line. It's the second number there. (The first number is the vocabulary size.)

If you mean in a Python model object -- try `model.layer1_size`.

Hope that helps,
Radim

David Batista

unread,
Dec 28, 2014, 6:18:11 PM12/28/14
to gen...@googlegroups.com
Hi Radim,

I meant the Python object. Thank you for your answer :)

--
./david

--
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/KMf6CTOSdxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gensim+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nawras Abureehan

unread,
Mar 22, 2017, 11:34:29 PM3/22/17
to gensim
same question here, did you manage to figure out how to find the size of the word2vec model?

ps: wow this is long time ago!

Andrey Kutuzov

unread,
Mar 23, 2017, 9:19:16 AM3/23/17
to gen...@googlegroups.com
Hi Nawras,

It's as simple as model.vector_size
See the docs at http://radimrehurek.com/gensim/models/word2vec.html
> <https://groups.google.com/d/topic/gensim/KMf6CTOSdxw/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email
> to gensim+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "gensim" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to gensim+un...@googlegroups.com
> <mailto:gensim+un...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--
Solve et coagula!
Andrey
Reply all
Reply to author
Forward
0 new messages