Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any range limitations of 'timesteps' in the LSTM input? #2057

Closed
Yingyingzhang15 opened this issue Mar 24, 2016 · 4 comments
Closed

Comments

@Yingyingzhang15
Copy link

Hi, I have a question about the input of LSTM layer.
The Keras Document says that the input data should be 3D tensor with shape (nb_samples, timesteps, input_dim). In my LSTM model, I set the timesteps as 50, but the model doesn't perform well. Is there any range limitations of 'timesteps'? Like smaller than a number ?
Can LSTM layer can use all the time information of each sequence?
Thank you in advance!

@viksit
Copy link

viksit commented Mar 24, 2016

What kind of data do you have, and could you shed some more light on what isn't working well?

AFAIK, there's no "limitation" on the timestep number.

@fchollet
Copy link
Member

No limitations, but for the sake of performance it's better to keep it
fairly small (aim at <200).

On 23 March 2016 at 19:08, Viksit Gaur notifications@github.com wrote:

What kind of data do you have, and could you shed some more light on what
isn't working well?

AFAIK, there's no "limitation" on the timestep number.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#2057 (comment)

@Yingyingzhang15
Copy link
Author

@viksit Thank you for your answer! My training data size is (45000,50,3), where 45000 is the nb_sample, 50 is timesteps and 3 is the input_dim. There are 3 classes to classify and I want to give every 50,3 vector a label. My validation data size is (7000,50,3).

Since I'm new to Keras, I just tried the two layer model and get the training accuracy 96%, validation accuracy 80%. I hope to get the accuracy of 95%. So should I just increase the number of layers?

There are many parameters(batch_size, epoch,dropout...) , it takes a lot of time to try different parameters. Could you give me some good advice, please?

My models:

model = Sequential()
model.add(LSTM(150, input_shape=(tsteps, 3), dropout_W=0.5, dropout_U=0.1))
model.add(Dense(3))
model.add(Activation('softmax'))
model.compile(loss='binary_crossentropy', optimizer='adam')

Thank you!

@Yingyingzhang15 Yingyingzhang15 changed the title Is there any range limits of 'timesteps' in the LSTM input? Is there any range limitations of 'timesteps' in the LSTM input? Mar 24, 2016
@Yingyingzhang15
Copy link
Author

@fchollet Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants