1
$\begingroup$

I'm trying to understand where the output of the LSTM is. Please refer to the following picture:

http://colah.github.io/posts/2015-08-Understanding-LSTMs/

It seems that at each tilmestep, we output h_t and C_t which correspond to the hidden state and the memory cell.

Now suppose I'm trying to model the stock price movements which is binary [0,1], 0 for down, 1 for up which is my y_i.

I feed in x_t which is a feature vector at each tilmestep and I expect to get a 1 dimensional output y_t after the last tilmestep.

Are h_t what I'm looking for? This would imply that h_t matches the output dimension, but for some reason I though it is independent of the output dimension.

$\endgroup$
1
  • $\begingroup$ For a certain time t, the output h_t is a scalar for each hidden unit. Then, if you have three hidden units, at t=n, H[n] = [h_1_t[n], h_2_t[n], h_3_t[n]]. The output dimension of H will depend only on the number of hidden units (aside from number of batches) not on the dimension of the input x[n] $\endgroup$
    – ignatius
    Nov 8, 2018 at 9:36

1 Answer 1

1
$\begingroup$

Usually you have to add a Dense layer after the LSTM unit. That will try to understand how to use the output of LSTM.

For example in Keras:

model = Sequential()
model.add(LSTM(4, input_shape=(1, 5)))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam')
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.