Questions tagged [lstm-stateful]

Tag refers to stateful long short-term memory (LSTM) cells in a neural network (i.e. cells that remember their state for the next training batch)

Stateful LSTMs will use the last state for each sample at index i in a training batch as initial state for the sample of index i in the following batch.

63 questions
1
vote
1 answer

Using output cell and hidden states of one LSTM cell as input states for another

Typically, when discussing stacking LSTMs (with independent weights), the cell and hidden states are unique to each individual cell and not shared between them. Each LSTM cell operates independently with its own set of states. Is there any reason…
1
vote
0 answers

Image sequence detection with Keras, Convolutional and Stateful Neural Network

I am trying to write a pretty complicated neural network (at least for me) in keras that needs to combine both a common CNN structure and an LSTM/GRU layer. Basically, I have a dataset of climatological maps of the Mediterranean sea, each map…
1
vote
2 answers

Irrelevant results of seq-to-seq LSTM

I am trying to predict a sequence of integers based on the input numbers. The input consists of values with 10 integers: array([[2021001001], [2021001002],..., ,[2021335249]],dtype=int64) The output is the following, an array containing 7…
1
vote
1 answer

Question on the number of samples in LSTM

from tensorflow.keras.models import Sequential from tensorflow.keras.callbacks import EarlyStopping from sklearn.model_selection import cross_val_score def build_model(): model2=Sequential() …
chee
  • 11
  • 1
1
vote
1 answer

Can I split my long sequences into 3 smaller ones and use a stateful LSTM for 3 samples?

I am doing a time-series sequence classification problem. I have 80 time-series all length 1002. Each seq corresponds to 1 of 4 categories (copper, cadmium, lead, mercury). I want to use Keras LSTMs to model this. These models require data to be fed…
codeananda
  • 939
  • 1
  • 10
  • 16
1
vote
0 answers

Scaling new data LSTM

I have a trained stateful LSTM model that with time series data for a set period, however new data might come in that falls outside of the MinMaxScaler I've used. For example the minimum value I have in my training set is 0.8 and the maximum is 1.5.…
Joseph Callaars
  • 1,770
  • 1
  • 19
  • 28
1
vote
0 answers

Cannot run LSTM in tensorflow lite 1.15

TLDR: Can someone show how to create LSTM, convert it to TFLite, and run it in android version 1.15? I am trying to create a simple LSTM model and run in in android application with tensorflow v115. ** It is the same case when using GRU and…
jonb
  • 845
  • 1
  • 13
  • 36
1
vote
0 answers

LSTM with Keras to optimize a black box function

I'm trying to implement the recurrent neural network architecture proposed in this paper (https://arxiv.org/abs/1611.03824), where the authors use a LSTM to minimize a black-box function (which however is assumed to be differentiable). Here is a…
1
vote
1 answer

TensorFlow different input and output shapes for stateful LSTM model

I would like to create a 'Sequential' model (a Time Series model as you might have guessed), that takes 20 days of past data with a feature size of 2, and predict 1 day into the future with the same feature size of 2. I found out you need to specify…
xdraxulisx
  • 83
  • 1
  • 8
1
vote
0 answers

How do I fix the following error in my LSTM in Keras? If a RNN is stateful, specify the `batch_input_shape`

I have the following error from running my LSTM in Keras: ValueError: If a RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: - If using a Sequential model, specify the batch size by passing a…
1
vote
1 answer

Using LSTM stateful for passing context b/w batches; may be some error in context passing, not getting good results?

I have checked the data before giving it to the network. The data is correct. Using LSTM and passing the context b/w batches. per_class_accuracy is changing, but the loss is not going down. Been stuck for long, not sure if there is an error in the…
harsh
  • 577
  • 7
  • 10
1
vote
0 answers

tf.keras.layers.LSTMCell VS tf.compat.v1.nn.dynamic_rnn

Let's consider a simple dataset: X_train = np.ones((2, 5, 4)) To implement a simple LSTM model and run the dataset through it (without training), I can do the following: lstm_model =…
NC520
  • 346
  • 3
  • 13
1
vote
1 answer

State persistence in shared LSTM layers in Keras

I am trying to use a shared LSTM layer with state in a Keras model, but it seems that the internal state is modified by each parallel use. This raises two questions: When training a model with a shared LSTM layer and using stateful=True, are the…
1
vote
0 answers

Train Keras LSTM step by step (stateful)

When using Keras + TF 1.14 (Non eager) is it possible to train an LSTM step by step to be more memory efficient? Coming from PyTorch, I could pass the sequence step by step, do back propagation and use the hidden state for the next step without…
lapayo
  • 97
  • 1
  • 8
1
vote
1 answer

TF 2.0 sequential CNN into LSTM for regression "Negative dimension size" error

I'm trying to build a model that predict the price of a certain commodity based on current market conditions, my data are shaped similar to num_samples = 100 sample_dimension = 10 XXX =…
Mohammad Athar
  • 1,953
  • 1
  • 15
  • 31