What is the parameter “size” means in gensim.model.Word2Vec(sentence, size)?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



What is the parameter “size” means in gensim.model.Word2Vec(sentence, size)?



I have just been started learning about word embeddings and gensim and I tried this code
. In this article during the visualisation it says we need PCA to convert high-dimensional vectors into low-dimensions. Now we have a parameter "size" in Word2Vec method, so why can't we set that size equals to 2 rather using PCA.
So, I tried to do this and compare both graphs (one with 100 size and other with 2 as size) and got very different result. Now I am confused that what this "size" depicts? How the size of vectors affect this?



enter image description here



This is what I got when I used 100 as size.



enter image description here



This is what I got when I used 2 as size.




1 Answer
1



So first of all you are applying two completely different algorithms. Thats why you are getting different results.



The size hyper parameter is indeed the dimension:


size



size (int, optional) – Dimensionality of the word vectors.



You can take a look here at the documentation.



The higher the number of dimensions you are using the more information you can store theoretically.



So considering you have only two dimensions the information content you can store is very limited. But the problem here is also that w2v is not designed to be very economic with dimension space. So w2v is not "very space" efficient, even though your all your information content could theoretically be stored in let's say 50 dimensions you will get better results with 60 dimensions.



PCA on contrary is designed to be very "space efficient" with respect to the dimensions. It's aim is to have as little information loss as possible when reducing the number of dimensions.



So you are dealing with two very different algorithms with different aims, that's why you're getting these different results.
Therefore your w2v model with 100 dimensions reduced to 2 dimensions using PCA will show better results than the w2v model which is just trained with 2 dimensions.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard