# Questions tagged [lstm]

Long Short Term Memory. A neural network architecture that contains recurrent NN blocks that can remember a value for an arbitrary length of time. A very popular building block for deep NN.

**0**

votes

**0**answers

2 views

### Defining initial values of states for a bidirectional layer in Keras

I am trying to define initial states of a bidirectional layer, I can't figure out how to define the initial states for the layer. I could define initial states for a simple lstm RNN, however when I ...

**-2**

votes

**0**answers

12 views

### After training the Model the RMSE and MSE values is that. Is my model performing well or not?

I am using LSTM for training purpose.I have divided the datasets into training and validation sets.After training the model, the Root Mean Squared Error(RMSE) and Mean Square Error(MSE) values is:
...

**1**

vote

**1**answer

18 views

### Why am I getting Nan after adding relu activation in LSTM?

I have simple LSTM network that looks roughly like this:
lstm_activation = tf.nn.relu
cells_fw = [LSTMCell(num_units=100, activation=lstm_activation),
LSTMCell(num_units=10, activation=...

**0**

votes

**0**answers

24 views

### Using ConvLSTM2D to Predict Next Frame in a Single SpatioTemporal Series [on hold]

Aim: Predict the next time-frame of crime counts using convolutional LSTMs. The aim is to run in such a fashion that the model makes predictions as new data becomes available.
Problem: Unsure on ...

**0**

votes

**1**answer

15 views

### Is there a way to make the of input channels in python equals to dimension of filters?

My problem here that I want to make the number of input channels in python equals to dimension of filters
i already tried to reshape but it gives me the same error .. and because I am new in python I ...

**-1**

votes

**0**answers

18 views

### TypeError: Input 'y' of 'Equal' Op has type float32 that does not match type int32 of argument 'x'

I'm pretty new to Keras and LSTMs. I've been trying to train my model of sequences to predict the future price of a stock with the code below but the error above kept popping up.
I have tried ...

**0**

votes

**1**answer

22 views

### What is the difference between these two ways of building a model in keras?

I am new to Keras and after going through a few tutorials i started building a model and found these two styles of implementations. However i am getting an error in the first one and second one works ...

**0**

votes

**1**answer

10 views

### LSTM Model not getting instantiated

I'm trying to create a baseline model, for an NER task, using a Bi-directional LSTM with the functional API provided by Keras
The embedding layer I've used is a 100-dimensional feature vector
Input ...

**0**

votes

**0**answers

10 views

### Keras ConvLSTM2D: why use the averagepooling3d and how to to regression

i have been studying Keras ConvLSTM2D: ValueError on output layer
i want to use the same code but i want to do regression ( single value ).
I dont know how to do this. And i also dont understand the ...

**0**

votes

**0**answers

6 views

### Duration model issue

I am training phone duration model for speech synthesis system using BLSTM model with one layer of 2048 neurones. I give the sequence of phones to the model and I get the duration in millisecond for ...

**0**

votes

**1**answer

12 views

### can we find the required string in image using CNN/LSTM? or do we need to apply NLP after extracting text using CNN/LSTM. can someone please clarify?

Im building a parser algorithm on images. tesseract not giving accuracy. so im thinking to build a CNN+LSTM based model for image to text conversion. is my approach is the right one? can we extract ...

**-2**

votes

**0**answers

22 views

### I want Python Code for rainfall prediction using RNN algorthim [on hold]

Here I attached Dataset for rainfall prediction
Kindly Please Help!!

**1**

vote

**0**answers

25 views

### Predicting rare events and their strength with LSTM autoencoder

I’m currently creating and LSTM to predict rare events. I’ve seen this paper which suggest: first an autoencoder LSTM for extracting features and second to use the embeddings for a second LSTM that ...

**0**

votes

**3**answers

31 views

### why set return_sequences=True and stateful=True for tf.keras.layers.LSTM?

I am learning tensorflow2.0 and follow the tutorial. In the rnn example, I found the code:
def build_model(vocab_size, embedding_dim, rnn_units, batch_size):
model = tf.keras.Sequential([
tf....

**0**

votes

**0**answers

40 views

### ValueError: Error when checking input: expected lstm_1_input to have 3 dimensions, but got array with shape (6782, 36)

I tried to do human pose action recognition model,
I referred this model
I like to use LSTM for this model. So I have made some changes in train.py
My train.py code:
import pandas as pd
from ...

**-2**

votes

**0**answers

13 views

### Creating an encoder-decoder with LSTM and bag of words

I am wondering how to create a specific type of encoder-decoder. I would like to know the best approach and also see a snippet of code.
I want to create embeddings for diagnosis code. Each row of my ...

**-2**

votes

**0**answers

16 views

### One hot Encoding for Time Series LSTM Regression Model

I have a dataset of some metrics regarding exports and imports for various countries.
Year, Country, Area, Crush, Beginning_Stocks, Production, Exports, Ending_Stocks, Imports
My objective is to try ...

**1**

vote

**0**answers

28 views

### TensorFlow Neural Network LSTM: Loss Function for Temporal Error

Let's say we are trying to predict future earthquakes based on previous earthquakes. A visualisation of part of a dataset containing sequences of earthquakes may look like this (features to the left, ...

**-1**

votes

**0**answers

16 views

### Keras Masking with embedding layer still calculates the loss on padding

i am trying to implement bidirectional lstm with embedding layer.first i did not add the masking for the padding in the embedding layer and my model was always predicting pad symbol then i added it ...

**0**

votes

**0**answers

19 views

### Implementing Bi-LSTM and CRF on Chinese address parsing task

I am now working on a Bi-LSTM-CRF model with keras and keras_contrib for Chinese address parsing task.
I have built both the models with and without CRF layer and after adding the crf layer, I got ...

**1**

vote

**0**answers

37 views

### pytorch LSTM does not overfit single sample

I try to overfit a single time series. Meaning, I try to perform the training on a single (X,Y) pair over and over again. I do this to get an impression of the capabilities of the hyperparameters. But ...

**0**

votes

**0**answers

12 views

### keras conv_lstm the keras model with the conv_lstm layer can't converge .the loss is about 1600

the keras model with the conv_lstm layer can't converge. The loss is about 1600. I don't know how to make it converge?
Loss after some epochs not decreasing and no improvement in train-accuracy.
I ...

**0**

votes

**0**answers

37 views

### Keras model predicting wrong values(accuracy: 0.0000e+00)

Que the cliche "This is my first Keras project", but alas, this is the truth. I apologize for any cringe beginner mistakes in advance.
How is the data setup
Column A: We capture the time a given ...

**0**

votes

**0**answers

19 views

### architecture for multivariate time series networks where some variables are shared across units

I've got a time series that has the following shape:
arr.shape
Out[9]: (2864, 98, 34)
So, 2864 units, 98 time steps, and 34 variables. The 98 time steps are annual.
I've also got a "global" ...

**0**

votes

**2**answers

17 views

### Manual Tagging of Words for NLP

I am a newbie in machine learning, named entity recognition and am assigned a task to manually tag my data in hundreds of paragraphs to retrain a Bidirectional LSTM model. Is there a better approach ...

**0**

votes

**0**answers

23 views

### Language translation model using seq2seq method in keras

I am trying to perform English to Spanish translation using seq2seq word level translation model, using this
I have used a dataset which contain 10000 English and Spanish sentences separated by tab.
...

**0**

votes

**0**answers

17 views

### Tensorflow Incompatible shapes

I'm learning how to deal with Tensorflow and how to predict some data from .csv files. Basically, I follow the guide from https://blog.goodaudience.com/first-experience-of-building-a-lstm-model-with-...

**2**

votes

**1**answer

45 views

### Import LSTM from Tensorflow to PyTorch by hand

I am trying to import a pretrained Model from tensorflow to PyTorch. It takes a single input and maps it onto a single output.
Confusion comes up, when I try to import the LSTM weights
I read the ...

**0**

votes

**0**answers

19 views

### Restoring a saved model and evaluating on a new Tensorflow Data object

I have this saved model and I want to restore it. After I restore, I want to evaluate it on a new dataset which I feeding with a Tensorflow Data input pipeline.
import tensorflow as tf
from ...

**1**

vote

**0**answers

10 views

### why my LSTM+ctc network predict just the last classed that learn? [closed]

I trying to code my data, based on this code
https://github.com/stardut/ctc-ocr-tensorflow
my data is a numerical string.
in total, my accuracy rate is so perfect, but when I want to test the net, ...

**-1**

votes

**0**answers

27 views

### Transfer LSTM in Keras to LSTM in Pytorch

I am using keras in LSTM, and I want to transfer it to LSTM in Pytorch. I have the following code:
LSTM model in keras:
from keras.layers import Input
from keras.layers.recurrent import LSTM
from ...

**1**

vote

**1**answer

18 views

### Can you make an LSTM forget context manually?

I am very new to machine learning and was wandering if it’s possible to manually empty an LSTM’s short term memory. Say, for instance, I wanted to train an LSTM on the sentence
“Jack and Jill went up ...

**0**

votes

**0**answers

19 views

### Handling long timestep sequences in LSTM

I'm trying to use LSTM to predict information on timestep sequences.
My data looks that way: I have few different samples of relatively long sequences (>100000 timesteps) and I'm trying to solve a N-...

**0**

votes

**1**answer

25 views

### Multiple Lstm after and before fully connected

I have written an architecture in Keras which works fine, but I want to implement the same architecture in tensorflow. I am writing the architecture in tensorflow but I am not able to create multiple ...

**-2**

votes

**0**answers

12 views

### 2D CNN requires input in the form of matrix, then how to feed MFCCs features into the network of CNN+LSTM?

I am working on speech recognition and trying to use MFCCs for input of CNN + LSTM network. But, i am not understanding how to make the MFCCs data structure to give input to CNN ?

**0**

votes

**0**answers

18 views

### Custom Data Generator for LSTM

Dataset: I have several .csv files with shape (no. of samples, 60,200) where number of samples can vary.
LSTM model: I have am LSTM model accepting input of shape (60,200)
I am trying to make a ...

**0**

votes

**0**answers

16 views

### Data preparation for NER in CONLL 2003 BIO format

To train my own NER over custom entities, I need my dataset preapared with CONLL-2003 format as specified in - https://github.com/yongyuwen/sequence-tagging-ner.
How would I convert my text documents ...

**-1**

votes

**0**answers

41 views

### odd python list behavior before and after an operation [closed]

I am facing an odd condition, I don't know what happens before and after an operation for a python list object. If you want more information notify me to add more information. I save a numpy value in ...

**0**

votes

**2**answers

24 views

### RNN LSTM Sentiment analysis model with low accuracy

I have a dataset with 200000 samples.
I am using the train_test_split from Sklearn.
model = Sequential()
model.add(Embedding(50000,128, input_length=14))
model.add(LSTM(16, return_sequences=True, ...

**0**

votes

**1**answer

27 views

### Different time_step input for LSTM in Keras

I'm trying to build a encoder-decoder network to classify video data. Reading the Keras documentation for LSTM cells, it expects a fixed number of time_step to the cell. However, the data that I'm ...

**1**

vote

**0**answers

47 views

### Can not squeeze dim[1], expected a dimension of 1, got 499

I am trying to make an AutoEncoder and am stuck at the above error. Looking at other posts with this on Stack Exchange didn't help.
Here is the error in full:
InvalidArgumentError: Can not squeeze ...

**0**

votes

**0**answers

18 views

### LSTMs passing multiple times series as input

I have a few, perhaps basic, questions about LSTMs and how they work. I spent some time trying to find these answers but I have not quite found what I am looking for. As I am relatively new to neural ...

**0**

votes

**0**answers

25 views

### How to make custom generator to overcome memory constraints for training LSTM network? [closed]

I'm trying to train a very long time series. It easily overshoots my computer's memory. I want to use the fit_generator method to train the model. Is it possible to make a custom generator which will ...

**0**

votes

**1**answer

23 views

### LSTMCell parameters is not shown Pytorch

I have the following code:
class myLSTM(nn.Module):
def __init__(self, input_size, output_size, hidden_size, num_layers):
super(myLSTM, self).__init__()
self.input_size = input_size + 1
...

**1**

vote

**1**answer

24 views

### ValueError: Index out of range using input dim 2; input has only 2 dims for 'crf_1/strided_slice

I'm trying to implement crf rather softmax after BiLSTM, and I'm using keras_contrib to get crf. I think I make some mistake about dimention of array, but I can't fix it.
Here is code:
# preds = ...

**0**

votes

**0**answers

6 views

### How to give 3 input in bi directional lstm

MY project contain 3 input Passage,question,option and i want to get the output "correct answer" from those input. So could you please help to know hoe to give the inputs to the model, I have done by ...

**-2**

votes

**0**answers

15 views

### matlab neural network for change point detection in data stream (on-line detection)

I'm working on a project, and I need your help. I'm working with time series and step change detection. The goal is to realize an artificial neural network, that properly trained, is able to identify ...

**0**

votes

**1**answer

18 views

### How to get the learned respresentation in keras LSTM Autoencoder

I have a multi layer LSTM autoencoder whose input is a 20 step time series with 4 attributes.
model = Sequential()
model.add(CuDNNLSTM(128, input_shape=(20, 4), return_sequences=True)) # ...

**0**

votes

**0**answers

27 views

### Many to one architecture of LSTM in Tensorflow

I want to do a many to one LSTM model, but I am having trouble of transforming by data into two inputs. In total there are 150 samples with 8 features (columns A to H) and column I is the label.
Data ...

**2**

votes

**2**answers

38 views

### Training and evaluating accuracies different in keras LSTM model: why does evaluation not produce same results as during training?

We are building an LSTM for modeling a physical optical procees.
So far, I have produced the following code in python using Keras with Tensorflow backend.
#Define model
model = Sequential()
model....