1
ここでは、別のデータセットを使用してhttps://blog.keras.io/using-pre-trained-word-embeddings-in-a-keras-model.htmlのチュートリアルに従っています。私は新しいランダムな文字列のラベルを予測しようとしています。文字列に単語を埋め込んだケラス予測。
私は少し異なる標識やってる:
encoder = LabelEncoder()
encoder.fit(labels)
encoded_Y = encoder.transform(labels)
dummy_y = np_utils.to_categorical(encoded_Y)
をそして同じように予測しようとしている:
string = "I am a cat"
query = tokenizer.texts_to_sequences(string)
query = pad_sequences(query, maxlen=50)
prediction = model.predict(query)
print(prediction)
私は(おそらくワード埋め込み?)以下のような配列の配列を取り戻します。それらは何ですか?それらを文字列に戻すにはどのように変換できますか?エンコーダで
[[ 0.03039312 0.02099193 0.02320454 0.02183384 0.01965107 0.01830118
0.0170384 0.01979697 0.01764384 0.02244077 0.0162186 0.02672437
0.02190582 0.01630476 0.01388928 0.01655456 0.011678 0.02256939
0.02161663 0.01649982 0.02086013 0.0161493 0.01821378 0.01440909
0.01879989 0.01217389 0.02032642 0.01405699 0.01393504 0.01957162
0.01818203 0.01698637 0.02639499 0.02102267 0.01956343 0.01588933
0.01635705 0.01391534 0.01587612 0.01677094 0.01908684 0.02032183
0.01798265 0.02017053 0.01600159 0.01576616 0.01373934 0.01596323
0.01386674 0.01532488 0.01638312 0.0172212 0.01432543 0.01893282
0.02020231]