tensorflow / skflow

Simplified interface for TensorFlow (mimicking Scikit Learn) for Deep Learning
Apache License 2.0
3.18k stars 439 forks source link

using a pre-train word embeddings in text_classification_cnn #160

Closed lixiaosi33 closed 8 years ago

lixiaosi33 commented 8 years ago

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?

ilblackdragon commented 8 years ago

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.