maxoodf/word2vec

Where can I find documentation on calculation of gradient gradientXalpha in word2vec?

Opened this issue · 0 comments

You write "word2vec++ code is simple and well documented". Could you please help me with some link to a document which could help me to understand the math behind the line you inherited from the original code:

File trainThread, line 237:

auto gradientXalpha = (1.0f - static_cast(huffmanData->huffmanCode[i]) - f) * (*m_sharedData.alpha);

I can't grasp the idea behind this "1.0f - ...".

As I understand the gradient intended to mack Huffman code as close as possible to value f we calculated above. If so, what is the reason of this "1.0f - ..."? Especially taking into account that the huffmanCode is either 0 or 1, so this "1-..." just reverses it. What it the intend/logic behind it?