-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
difficulty in understanding starspace_embedding() behavior #6
Comments
If you want embeddings of ngrams and your model is trained with ngram > 1, you should probably use |
Thanks for the response. However I now feel confused with the difference between |
Did you check by dividing your embedding summation by Size^p as I indicated. Size is for your case 2 as you have 2 Words and p is by default 0.5. That is what you get if you specify type=“document”, if you specify type=“ngram” starspace is using the hashing trick from fasttext to find out in which Bucket the ngram lies and then retrieves the embedding of that. You can inspect the c++ code for that. |
Yes, I did divide the embedding summation by Size^p. Let me rephrase my question in a clearer way. If however, if the What am I missing to understand the difference between ngrams=1 model vs ngrams=2 model? Thanks |
So to go short, for bigrams, the unigram words the embeddings are retrieved and for the bigram (if the model was trained with ngram > 1) it gets the embedding of the right hashed bucket. |
Nevertheless, although reproducing these hashed combinations from R is non-reproducible without touching some C++ code, I tried the following experiments and hoped at the last example that if I took the ngram embedding of the bigram, and add it to the embeddings of the unigrams, that would be the same as the document embedding but apparently this is not what happened. Maybe it would be nice to ask this to the Starspace authors themselves
|
I am trying to replicate the return value of
starspace_embedding()
function. Here is what I have found so far.When training a model with ngrams = 1,
starspace_embedding(model, 'word1 word2')
=as.matrix(model)['word1', ] + as.matrix(model)['word2', ]
normalized accordingly. However this doesn't hold when the model trained with ngrams > 1.thanks in advance
The text was updated successfully, but these errors were encountered: