1.什么是word2vector? 我们先来看一个问题,假如有一个句子 " the dog bark at the mailman". 假如用向量来表示每个单词,我们最先想到的是用one hot 编码的方式来表达每个单词,具体来说. the 可以表示为 [1,0,0,0,0] dog 可以表示为 [0,1,0,0,0] bark 可以表示为 [0,0,1,0,0] at 可以表示为[0,0,0,1,0] mailman可以表示为[0,0,0,0,1] 我们可以看到每个单词其实就…
引子 在上次的 <word2vector论文笔记>中大致介绍了两种词向量训练方法的原理及优劣,这篇咱们以skip-gram算法为例来代码实践一把. 当前教程参考:A Word2Vec Keras tutorial 导库 import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.layers import Input, Dense, Reshape, Dot, Embedding from t…