Skip to content
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

为什么CBOW模型的变量g的计算方法和源码不一样啊? #42

Open
HongLWang opened this issue Jun 19, 2018 · 1 comment
Open

Comments

@HongLWang
Copy link

HongLWang commented Jun 19, 2018

您好,在你的Learn.jaja文件里面,第233-236行是变量g的计算方法,word2vec的源码的计算方法是和第234行一样的但是被你注释掉了,改成了236行的方法,为什么要这样改呢?这样结算出来的结果和源码差很多啊。

  // 'g' is the gradient multiplied by the learning rate
  // double g = (1 - word.codeArr[d] - f) * alpha;
  // double g = f*(1-f)*( word.codeArr[i] - f) * alpha;
  double g = f * (1 - f) * (word.codeArr[d] - f) * alpha;
@CallMeJiaGu
Copy link

同样的疑问,不过我使用下面的的公式,效果还是有的。
double g = (1 - word.codeArr[d] - f) * alpha;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants