2016-06-25 42 views

回答

1

即張量流程示例已經有一個函數來計算的相似性,並顯示最近的單詞。 最簡單的方法是使用該功能。

在定義valid_examples之後的第4步中,可以給出你自己的單詞。

valid_examples = np.random.choice(valid_window, valid_size, replace=False) 
num_sampled = 64 # Number of negative examples to sample. 

sample_word = "dog"; 
if sample_word in dictionary: 
    sample_index = dictionary[sample_word] 
else: 
    sample_index = 0 # dictionary['UNK'] 
valid_examples[0] = sample_index 

然後你可以在第一行看到結果。對於恩,我的結果是

最近的狗:授權,侄子,文具,狨猴,哇,KVAC, dasyprocta,半人馬,

相關問題