tensorflow / skflow

Simplified interface for TensorFlow (mimicking Scikit Learn) for Deep Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

using a pre-train word embeddings in text_classification_cnn

lixiaosi33 opened this issue · comments

word_vectors = skflow.ops.categorical_variable(X, n_classes=n_words,
embedding_size=EMBEDDING_SIZE, name='words')
word_vectors = tf.expand_dims(word_vectors, 3)

when i debug this patch of code, i can't explain how it works.

How to use the results of Word2vec or a GloVe pre-trained word embedding instead of a random one?

I'm going to add functionality for loading pre-trained embeddings.
Right now you can map your ids into embeddings before passing them into est.fit. I'll move this bug into tensorflow/tensorflow repository (where skflow has been moved).

About debugging that part - that's a bit hard part of working with Tensorflow - execution of graph building code is done later. I can recommend looking at tensorboard visualization of the graph to understand what is happening with this lines.