使用Python 2.7蟒蛇在Windows 10如何計算使用keras訓練的語言模型的困惑?
我培養了GRU的神經網絡來構建使用keras語言模型:
print('Build model...')
model = Sequential()
model.add(GRU(512, return_sequences=True, input_shape=(maxlen, len(chars))))
model.add(Dropout(0.2))
model.add(GRU(512, return_sequences=False))
model.add(Dropout(0.2))
model.add(Dense(len(chars)))
model.add(Activation('softmax'))
model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
如何計算這個語言模型的困惑?例如,NLTK爲其模型提供了困惑度計算功能。
嗨,謝謝你回答這個!這個變化非常大。你是否在數據集上實現了你的版本?我可以和你聯繫嗎? – ishido
我的榮幸:)是的,我正在對公共FCE數據集進行培訓 - 在cam dot ac dot uk的btd26上給我發電子郵件 – layser