What are the continuous bag of words(CBOW) and skip-gram?

Both architectures describe how the neural network “learns” the underlying word representations for each word. Since learning word representations is essentially unsupervised, you need some way to “create” labels to train the model. Skip-gram and CBOW are two ways of creating the “task” for the neural network – you can think of this as the output layer of the neural network, where we create “labels” for the given input (which depends on the architecture).

For both descriptions below, we assume that the current word in a sentence is wi .

CBOW: The input to the model could be wi2,wi1,wi+1,wi+2 , the preceding and following words of the current word we are at. The output of the neural network will be wi . Hence you can think of the task as “predicting the word given its context”.

Note that the number of words we use depends on your setting for the window size.

Skip-gram: The input to the model is wi , and the output could be wi1,wi2,wi+1,wi+2 . So the task here is “predicting the context given a word”. Also, the context is not limited to its immediate context, training instances can be created by skipping a constant number of words in its context, so for example, wi3,wi4,wi+3,wi+4 , hence the name skip-gram.

Note that the window size determines how far forward and backward to look for context words to predict.

According to Mikolov:

Skip-gram: works well with small amount of the training data, represents well even rare words or phrases.
CBOW: several times faster to train than the skip-gram, slightly better accuracy for the frequent words
This can get even a bit more complicated if you consider that there are two different ways how to train the models: the normalized hierarchical softmax, and the un-normalized negative sampling. Both work quite differently.

which makes sense since with skip gram, you can create a lot more training instances from limited amount of data, and for CBOW, you will need more since you are conditioning on context, which can get exponentially huge.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值