lstm

Why my ConvLSTM model can not predict?

南笙酒味 提交于 2019-12-01 02:04:12
I have built a Convolutional LSTM model using Tensorflow ConvLSTMCell(), tf.nn.dynamic_rnn(), and tf.contrib.legacy_seq2seq.rnn_decoder(). I have 3 layers of encoder, and 3 layers of decoder, the initial states of decoders come from the final states of encoders. I have 128, 64, and 64 filters for layer 1, layer 2, and layer 3 respectively. finally, I concatenate the outputs of decoders and pass them through a convolution layer to decrease the number of channels to one. and then I apply the loss function. My dataset is Moving mnist dataset. in Moving mnist dataset each sequence has 20 frames,

Stock price predictions of keras multilayer LSTM model converge to a constant value

流过昼夜 提交于 2019-12-01 01:17:10
I've made a multilayer LSTM model that uses regression to predict next frame's values of the data. The model finishes after 20 epochs. I then get some predictions and compare them to my ground truth values. As you can see them in the picture above, predictions converge to a constant value. I don't know why this happens. Here is my model so far: from keras.models import Sequential from keras.layers.core import Dense, Activation, Dropout from keras.layers import LSTM, BatchNormalization from tensorflow.python.keras.initializers import RandomUniform init = RandomUniform(minval=-0.05, maxval= 0.05

Python keras how to change the size of input after convolution layer into lstm layer

谁说我不能喝 提交于 2019-11-30 22:51:52
I have a problem with the connection between convolution layer and lstm layer. The data is of shape(75,5) where there is 75 timesteps x 5 data points for each time step. What I want to do is do a convolution on (75x5), get new convolved (75x5) data and feed that data into lstm layer. However, it does not work because the shape of output of convolution layer has number of filters which I do not need. And therefore the shape of convolution layer output is (1,75,5) and input needed for lstm layer is (75,5). How do I just take the first filter. model = Sequential() model.add(Convolution2D(1, 5,5

LSTM - Making predictions on partial sequence

情到浓时终转凉″ 提交于 2019-11-30 21:47:29
This question is in continue to a previous question I've asked. I've trained an LSTM model to predict a binary class (1 or 0) for batches of 100 samples with 3 features each, i.e: the shape of the data is (m, 100, 3), where m is the number of batches. Data: [ [[1,2,3],[1,2,3]... 100 sampels], [[1,2,3],[1,2,3]... 100 sampels], ... avaialble batches in the training data ] Target: [ [1] [0] ... ] Model code: def build_model(num_samples, num_features, is_training): model = Sequential() opt = optimizers.Adam(lr=0.0005, beta_1=0.9, beta_2=0.999, epsilon=1e-08, decay=0.0001) batch_size = None if is

AttributeError: module 'tensorflow.python.ops.rnn' has no attribute 'rnn'

时光总嘲笑我的痴心妄想 提交于 2019-11-30 20:05:48
TensorFlow原版本报错:AttributeError: module 'tensorflow.python.ops.rnn' has no attribute 'rnn' from tensorflow.python.ops import rnn, rnn_cell lstm_cell = rnn_cell.BasicLSTMCell(rnn_size,state_is_tuple=True) outputs, states = rnn.rnn(lstm_cell, x, dtype=tf.float32) 应该替换为: from tensorflow.contrib import rnn lstm_cell = rnn.BasicLSTMCell(rnn_size) outputs, states = rnn.static_rnn(lstm_cell, x, dtype=tf.float32) 来源: CSDN 作者: 黄鑫huangxin 链接: https://blog.csdn.net/qq_33373858/article/details/83097027

deep_learning_LSTM长短期记忆神经网络处理Mnist数据集

假装没事ソ 提交于 2019-11-30 18:29:06
1、RNN(Recurrent Neural Network)循环神经网络模型 详见RNN循环神经网络: https://www.cnblogs.com/pinard/p/6509630.html 2、LSTM(Long Short Term Memory)长短期记忆神经网络模型 详见LSTM长短期记忆神经网络: http://www.cnblogs.com/pinard/p/6519110.html 3、LSTM长短期记忆神经网络处理Mnist数据集 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from tensorflow.contrib import rnn # 载入数据集 mnist = input_data.read_data_sets( "MNIST_data/" , one_hot = True ) # 输入图片是28

论文研读《Long short-term memory for machine remaining life prediction》

 ̄綄美尐妖づ 提交于 2019-11-30 14:49:43
研究动态系统例如飞机发动机的剩余寿命预测。系统性能退化跟踪和剩余寿命预测。 因传统的机器学习算法在适应制造系统和过程的复杂和非线性特性时往往受到限制,深度学习方法可以客服传统方法的不足,提高系统复杂度的表征能力。本文提出了一种基于lstm网络的方法,该网络是一种专门用于发现嵌入在时间序列中的底层模式的体系结构,用于跟踪系统的退化,从而预测剩余寿命。本文的目标是:1)将原始传感器数据转换为可解释的健康指数,以便更好地描述系统的健康状况;2)跟踪历史系统退化情况,以便准确预测其未来的健康状况。使用美国宇航局的C-MAPSS数据集进行评估,验证了所提出方法的有效性。与其他机器学习技术相比,lstm由于其本质上的时变结构,在去除退化模式方面更为强大和准确。 背景:根据对系统当前健康状态的实时分析来估计系统性能退化,实现基于状态的制造系统健康状态推断,为预测其未来物理行为提供科学依据。 多年来,预测学已经发展成为一个活跃的研究领域。制造业预测的最新发展主要集中在两种方法上:贝叶斯方法和机器学习方法。     推断下垫齿轮箱轴承的退化过程 轴承 齿轮   此外,lstm还用于预测刀具磨损、燃料电池电压输出、锂离子电池容量和轴承健康状态。 研究内容:在前人研究的启发下,本文提出了一种基于双向lstm的系统退化行为表征及剩余使用寿命预测方法。在lstm结构中嵌入长期相关性特征

What is a “cell class” in Keras?

不羁的心 提交于 2019-11-30 12:46:04
Or, more specific: what is the difference between ConvLSTM2D and ConvLSTM2DCell ? What is the difference between SimpleRNN and SimpleRNNCell ? Same question for GRU and GRUCell Keras manuals are not very verbose here. I can see from RTFS (reading those fine sources) that these classes are descendants of different base classes. Those, with names, ending with Cell , are subclasses of Layer . In my task I need to classify video sequences. That is, my classifier's input is a sequence of video frames, and the output is a single label (one-hot encoded vector). What class should I use? The difference

TensorFlow using LSTMs for generating text

痞子三分冷 提交于 2019-11-30 10:50:56
问题 I would like to use tensorflow to generate text and have been modifying the LSTM tutorial (https://www.tensorflow.org/versions/master/tutorials/recurrent/index.html#recurrent-neural-networks) code to do this, however my initial solution seems to generate nonsense, even after training for a long time, it does not improve. I fail to see why. The idea is to start with a zero matrix and then generate one word at a time. This is the code, to which I've added the two functions below https:/

Keras : How should I prepare input data for RNN?

£可爱£侵袭症+ 提交于 2019-11-30 10:49:56
问题 I'm having trouble with preparing input data for RNN on Keras. Currently, my training data dimension is: (6752, 600, 13) 6752: number of training data 600: number of time steps 13: size of feature vectors (the vector is in float) X_train and Y_train are both in this dimension. I want to prepare this data to be fed into SimpleRNN on Keras. Suppose that we're going through time steps, from step #0 to step #599. Let's say I want to use input_length = 5 , which means that I want to use recent 5