word2vec
class ContinuousBoW(chainer.Chain):
def __init__(self, n_vocab, n_units, loss_func):
super(ContinuousBoW, self).__init__(
embed=F.EmbedID(n_vocab, args.unit),
loss_func=loss_func)
def __call__(self, x, context):
h = None
for c in context:
e = self.embed(c)
h = h + e if h is not None else e
return self.loss_func(h, x)
45
コンテキストの平均を取って出
⼒力力に投げるだけ
埋め込みベクトル