r1d*_*1d1 2 python nlp machine-learning gensim word2vec
对于 Skip-gram word2vec 训练样本获取如下:
Sentence: The fox was running across the maple forest
Run Code Online (Sandbox Code Playgroud)
这个词fox
给下对训练:
fox-run, fox-across, fox-maple, fox-forest
Run Code Online (Sandbox Code Playgroud)
等等对于每个单词。CBOW w2v 使用反向方法:
run-fox, across-fox, maple-fox, forest-fox
Run Code Online (Sandbox Code Playgroud)
或者forest
一句话:
fox-forest, run-forest, across-forest, maple-forest
Run Code Online (Sandbox Code Playgroud)
所以我们得到了所有的对。如果我们在 CBOW 模式下训练时不指定目标词,那么在使用 gensim 库进行训练时,Skip-gram word2vec 和 CBOW w2v 有什么区别?在这两种情况下,是否都使用了所有单词对?
只有skip-gram 使用形式为 的训练对(context_word)->(target_word)
。
在 CBOW 中,训练示例是(average_of_multiple_context_words)->(target_word)
. 因此,当来自单个训练示例的错误被反向传播时,多个上下文词会得到相同的纠正性推动。
归档时间: |
|
查看次数: |
1643 次 |
最近记录: |