对于Skip gram word2vec,获得如下训练样本:
Sentence: The fox was running across the maple forest
这个词 fox
fox
fox-run, fox-across, fox-maple, fox-forest
等等,每一个字。CBOW w2v使用反向进近:
run-fox, across-fox, maple-fox, forest-fox
或为 forest 文字:
forest
fox-forest, run-forest, across-forest, maple-forest
所以我们得到了所有的一对。使用gensim库进行训练时,如果在CBOW模式下训练时不指定目标词,Skip gram word2vec和CBOW w2v之间有什么区别?在这两种情况下,是否使用所有成对的单词?
只有skip-gram使用了形式的训练对 (context_word)->(target_word)
(context_word)->(target_word)
在CBOW中,培训示例如下 (average_of_multiple_context_words)->(target_word) . 因此,当来自单个训练示例的错误被反向传播时,多个上下文单词会得到相同的纠正微调。
(average_of_multiple_context_words)->(target_word)