tensorflow / skflow

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

Adding example of using LSTM for text classification #67

Closed vinhqdang closed 8 years ago

vinhqdang commented 8 years ago

Hi,

I think it would be good to provide examples and make the directory examples be a list of recipe to use skflow.

ilblackdragon commented 8 years ago

Hi,

Hm, there is examples folder here - https://github.com/google/skflow/tree/master/examples with recipes on how to use skflow and it has LSTM for text classification on words and characters. Or you mean something else?

vinhqdang commented 8 years ago

Hi,

As http://colah.github.io/posts/2015-08-Understanding-LSTMs/, I would understand that LSTM is a special form of RNN

In the examples folder, I saw the example on RNN, but I am not sure if it is LSTM or not.

ilblackdragon commented 8 years ago

The examples in the folder are using Gated Recurrent Unit. But if you want to try LSTM you can easily switch line cell = rnn_cell.GRUCell(EMBEDDING_SIZE) to cell = rnn_cell.BasicLSTMCell(EMBEDDING_SIZE) or cell = rnn_cell.LSTMCell(EMBEDDING_SIZE).

You can see all RNN cells here - https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/rnn_cell.py

You can read about differences and comparison of using different cells in this paper - http://arxiv.org/pdf/1412.3555v1.pdf

vinhqdang commented 8 years ago

Hi, I think for LSTMCell we will need at least 1 more argument, I think EMBEDDING_SIZE is num_units parameter of LSTMCell, then the parameter input_size is missing

terrytangyuan commented 8 years ago

@vinhqdang See https://github.com/tensorflow/skflow/issues/5. You can just change cell_type to lstm.