我试图遵循tensorflow的udacity教程在那里我碰到下面两行来到一个字嵌入模型:Tensorflow负采样
# Look up embeddings for inputs.
embed = tf.nn.embedding_lookup(embeddings, train_dataset)
# Compute the softmax loss, using a sample of the negative labels each time.
loss = tf.reduce_mean(tf.nn.sampled_softmax_loss(softmax_weights, softmax_biases,
embed, train_labels, num_sampled, vocabulary_size))
现在我明白了第二个说法是,用于采样负标签。但问题是它如何知道负面标签是什么?我所提供的第二个功能是当前输入及其相应的标签以及我希望(负面)取样的标签数量。从输入集本身取样的风险是否不存在?
这是完整的例子:https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/udacity/5_word2vec.ipynb
“我认为TensorFlow在随机抽样时完全消除了这种可能性。”正确!有一个标志:'remove_accidental_hits':一个布尔。是否删除样本类别等于目标类别之一的“意外命中”。默认值为True.' – Alex
有没有人知道提供取样权重的方法? –