Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One to many LSTM in Keras

Is it possible to implement a one-to-many LSTM in Keras?
If yes, can you please provide me with a simple example?

like image 280
OSM Avatar asked Feb 24 '17 16:02

OSM


People also ask

How many LSTM cells should I use?

In general, there are no guidelines on how to determine the number of layers or the number of memory cells in an LSTM. The number of layers and cells required in an LSTM might depend on several aspects of the problem: The complexity of the dataset, such as the number of features, the number of data points, etc.

What is difference between LSTM and stacked LSTM?

The original LSTM model is comprised of a single hidden LSTM layer followed by a standard feedforward output layer. The stacked LSTM is an extension to this model that has multiple hidden LSTM layers where each layer contains multiple memory cells.

What is the use of return_sequences in LSTM?

When return_sequences parameter is True, it will output all the hidden states of each time steps. The ouput is a 3D array of real numbers. The third dimension is the dimensionality of the output space defined by the units parameter in Keras LSTM implementation.

Which is better LSTM or BiLSTM?

The results show that additional training of data and thus BiLSTM-based modeling offers better predictions than regular LSTM-based models. More specifically, it was observed that BiLSTM models provide better predictions compared to ARIMA and LSTM models.


1 Answers

It's possible with a RepeatVector layer. For example:

model = Sequential()
model.add(Dense(10, input_shape=(1))
model.add(RepeatVector(10))
model.add(LSTM(1, return_sequences=True))

Then - the input shape is (1) and the output is (10, 1).

like image 111
Marcin Możejko Avatar answered Sep 19 '22 16:09

Marcin Możejko