Problems to understand how to create the input data for time series forecasting with a recurrent neural network in Keras

I just started to use recurrent neural networks (RNN) with Keras for time-series forecasting and I found this tutorial Forecasting with RNN. I have difficulties understanding how to build the training data both regarding the syntax and the format of the input data. Here is the code: import pandas as pd import numpy as np import tensorflow as tf from tensorflow import keras from matplotlib import pyplot as plt # Read the data for the parameters from a csv file …
Category: Data Science

Does the sequence length of a RNN/LSTM have to be the same for the input and output?

I have a question about the input and output data in a RNN or LSTM. A RNN expects a 3-dimensional vector as input of the form (Batch_size, sequence_length_input, features_input) and a 3-dimensional output vector of the form (Batch_size, sequence_length_output, features_output). I know that the features_input and features_output don't have to have the same number. But what about the middle part sequence_length_input and sequence_length_output. Do they have to be the same? At least in my example (with Keras and Tensorflow) I …
Category: Data Science

RCNN to predict sequence of images (video frames)?

In the following work the authors apply a convolutional recurrent neural network (RNN) to predict the spatiotemporal evolution of microstructure represented by 2D image sequences. In particular, they apply some sort of 3D-CNN & LSTM architecture to predict crystal growth: In the above picture, we can see RNN predictions (P) versus ground truth (G) from a testing case, in which the RNN outputs 50 frames based on 10 input frames. Now, this is something new to me: how is possible …
Category: Data Science

Non-linear solver with RNN for MPC

Is it possible to use a non-linear solver to optimize the output of a recurrent neural network (RNN) by using a solver to find the optimal RNN inputs? For example, I want to optimize a RNN to a cost function for the purpose model predictive control. I want to predict future control steps by finding the minimum squared error to a cost function. The solver would iterate the input variables to generate an output at each time step. Part of …
Category: Data Science

Dual Branch Recurrent Neural Network, what is the correct architecture and can I turn off one branch?

Let's suppose I want to predict the daily consumption of apples in the next 30 days of a person and I have, as input, the historical information about the past 60 days and the demographic information of the given user. I was planning of building a Hybrid NN with two branches, one dense and one recurrent, let's say made with LSTMs, that are then concatenated to a final branch. I was wondering, since this branch will have as output a …
Category: Data Science

Question about Reservoir computing (echo state networks)

Does anyone know why reservoir computing is only applied to time-series (data with temporal structure) and has not been applied instead of usual ANN for non-temporal problems? According to (http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.720.616&rep=rep1&type=pdf) paper (page 4) it should be possible to define the leakage rate as 1 as a special case which I suppose mean no temporal learning, but I have not seen anyone actually considering it. Isn't it better to use reservoir computing instead of usual ANN to have a faster model?
Category: Data Science

Multivariate RNN/LSTM architecture for optimizing one input variable

Let $x = [x_1, x_2, x_3]$ and $y = y$ where all variables in $x$ correlates highly with $y$ and there could also be some crosscorrelation within the set of variables in $x$. The data takes the form of a sequence/timeseries. i.e for each timestep we have three independent variables and one dependent or one independent variable and three dependent depending on how we structure it. So the whole timeseries would be X = [x1, x2, x3, ...xn] and Y …
Category: Data Science

Use Lstm for classifying problem

i have a dataset of 10000 event with 16 feature, and a vector of dimension 10000 that represent the label of each event; for what i understand is a classification problem but it's required to use a Lstm. How it's possible to use a RNN for a classification that doesn't involve a temporal series? And how can i implement this in the code?
Category: Data Science

Back propagation process of RNN?

I'm learning how to use the Recurrent Neural Network model (RNN). I'm not entirely sure about the feed-forward procedure in RNN. It includes, for example, input, hidden state, and output. As far as I know, the hidden state is a type of multi-layer perception (MLP). However, in this case, a hidden state is derived from both current input and a previously hidden state. Unfortunately, "we can note that everyone reported the total number of memory cells, but no one specified …
Category: Data Science

Hopfield Network python implementation, Network doesn't converge to one of the learned patterns

I'm trying to implement a Hopfield Network in python using the NumPy library. The network has 2500 nodes (50 height x 50 width). The network learns 10 patterns from images of size 50x50 stored in "patterns" folder. The images are of numbers 0 to 9. The images are converted to 2d Array, flattened to 1d (2500x1) and learned. After learning the patterns, it is given a number of an image (from which I have removed a few pixels from) to …
Category: Data Science

How to put marker on time series training set

My input is this picture And I would like to put markers on it and use time series with markers as a label Two picture are not scaled. Main point is I would like to train RNN classifier and let it be able to mark the starting points and stopping points. More generalized examples Question What is the best function to be marker encoding function?
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.