Skip to content

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

@HongLWang

Description

@HongLWang

您好,在你的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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions