jbuddy_13
jbuddy_13

Reputation: 1284

How to get word embeddings back from Keras?

Say you create your own custom word embeddings in the process of some arbitrary task, say text classification. How do you get a dictionary like structure of {word: vector} back from Keras?

embeddings_layer.get_weights() gives you the raw embeddings...but it's unclear which word corresponds to what vector element.

Upvotes: 1

Views: 307

Answers (1)

Andrey
Andrey

Reputation: 6387

This dictionary is not a part of keras model. It should be kept separately as a normal python dictionary. It should be in your code - you use it to convert text to integer indices (to feed them to Embedding layer).

Upvotes: 1

Related Questions