ageron / handson-ml2

A series of Jupyter notebooks that walk you through the fundamentals of Machine Learning and Deep Learning in Python using Scikit-Learn, Keras and TensorFlow 2.
Apache License 2.0
27.98k stars 12.79k forks source link

[Chapter 16] How to visualize word embeddings in TensorBoard? #172

Open insuquot opened 4 years ago

insuquot commented 4 years ago

Hi, I'm new to Tensorflow and Keras--really enjoying your book!

How do you retrieve the 11,000 words (vocab_size + num_oov_buckets) from the StaticVocabularyTable in cell 54? At the end of the Sentiment Analysis section of chapter 16, you mention the possibility of using the TensorBoard() callback to watch the embeddings learned.

If I open TensorBoard Projector, I can see the word IDs, but not the words themselves. To do so, I tried to save the 10,000 vocabulary words to a TSV file, but I get an error message asking for 11,000 words. How can I retrieve all the words, especially the 1,000 OOV words?

insuquot commented 4 years ago

@ageron would love to get your thoughts on this

IvanKuchin commented 4 years ago

Hello @insuquot

You may use Load feature of TensorBoard to upload as many words as you want (+labels). Looks like you are familiar with Embedding Projector, but JFYI word embedding tutorial