lstm

LSTM: adding the encoder's hidden states to the decoder in order to increase performance

十年热恋 提交于 2019-12-13 05:28:15
问题 I am trying to experiment with transferring the hidden states of an LSTM from an encoder layer to a decoder layer, as demonstrated in the Keras blog. My data is randomly generated sine-waves (that is, wavelength and phase are determined randomly, as well as the length of the sequence), and the network is trained to receive a number of sine-waves and predict their progression. Without transferring the hidden states, my code is as follows: from keras.models import Model from keras.layers import

How can I use MultiRNNCell with cell= ConvLSTMCell?

北战南征 提交于 2019-12-13 05:08:24
问题 How can I build a multi-layer neural network with the different number of filters in each layer with cell = ConvLSTMCell() and MultiRNNCell? 回答1: cell_1 = ConvLSTMCell(...params...) cell_2 = ConvLSTMCell(...params...) multi_cell = MultiRNNCell([cell_1, cell_2], ...other params...) Then you can call tensorflow dynamic_rnn(..) api with multi_cell and required parameters. 来源: https://stackoverflow.com/questions/48942122/how-can-i-use-multirnncell-with-cell-convlstmcell

How does LSTM convert character embedding vectors to sentence vector for sentence classification?

痴心易碎 提交于 2019-12-13 03:49:34
问题 I want to build a LSTM model for sentence classification using character embeddings. I know how to do it using word embeddings where the model can learn the embeddings from word indexes but not sure how to do it with character embeddings. for word embeddings: sentence_list = ['this is a dog', 'the cat and the mouse'] label = [1,0] word_dict = {'this':1, 'is':2, 'a':3, 'dog':4, 'the':5, 'cat':6, 'and':7, 'mouse':8} # set vector length = 9 vectors = [[1,2,3,4,0,0,0,0,0] [0,0,0,0,5,6,7,5,8]]

Input contains NaN, infinity or a value too large for dtype('float64') in Tensorflow

元气小坏坏 提交于 2019-12-13 03:46:39
问题 I am trying to train a LSTM and in my model I have an exponential learning rate decay and a dropout layer. In order to deactivate the dropout layer when testing and validating, I have put a placeholder for the dropout rate and given it a default value of 1.0 and when training i am setting it to 0.5. The dropou_rate placeholder value is passed to the tf.layers.dropout(). When I run this during the validation I get the following error. ValueError: Input contains NaN, infinity or a value too

Sequence-to-sequence classification with variable sequence lengths in Keras

跟風遠走 提交于 2019-12-13 03:45:56
问题 I would like to train an LSTM or GRU network in TensorFlow/Keras to continuously recognize whether a user is walking or not based on input from motion sensors (accelerometer and gyroscope). I have 50 input sequences with lengths varying from 581 to 5629 time steps and 6 features and 50 corresponding output sequences of boolean values. My problem is that I don't know how to feed the training data to the fit() method. I know approximately what I need to do: I'd like to train with 5 batches of

how can you get the following(next) value of stock price(time series) with list using for loop?

穿精又带淫゛_ 提交于 2019-12-13 03:41:32
问题 here is my code a = x_test[-1:] b = model.predict(a) c = model.predict(np.array([list(a[0,1:])+[b]])) this is one day predict code in this code a = array([[[0.76165783], [0.7725424 ], [0.76774675], [0.7837351 ], [0.78315544], [0.7881376 ], [0.78365815], [0.79689795], [0.80051404], [0.8009032 ], [0.8078839 ], [0.80801773], [0.80524486], [0.8093028 ], [0.8162957 ], [0.82955176], [0.8293775 ], [0.83183414], [0.84109306], [0.84054583]]], dtype=float32) and b = array([[0.8390325]], dtype=float32)

Keras multi_gpu_model causes system to crash

主宰稳场 提交于 2019-12-13 03:33:32
问题 I am trying to train a rather large LSTM on a large dataset and have 4 GPUs to distribute the load. If I try to train on just one of them (any of them, I've tried each) it functions correctly, but after adding the multi_gpu_model code it crashes my entire system when I try to run it. Here is my multi-gpu code batch_size = 8 model = Sequential() model.add(Masking(mask_value=0., input_shape=(len(inputData[0]), len(inputData[0][0])) )) model.add(LSTM(256, return_sequences=True)) model.add

Entity Embedding of Categorical within Time Series Data and LSTM

放肆的年华 提交于 2019-12-13 03:19:15
问题 I'm trying to solve a time series problem. In short, for each customer and material (SKU code), I have different orders placed in the past. I need to build a model that predict the number of days before the next order for each customer and material. What I'm trying to do is to build an LSTM model in Keras, where for each customer and material I have a 50 max padded timesteps of history, and I'm using a mix of numeric (# of days since previous order, AVG days between orders in last 60 days etc

How to set up LSTM network for predict multi-sequence?

断了今生、忘了曾经 提交于 2019-12-13 03:18:49
问题 I am learning how to set up the RNN-LSTM network for prediction. I have created the dataset with one input variable. x y 1 2.5 2 6 3 8.6 4 11.2 5 13.8 6 16.4 ... By the following python code, I have created the window data, like [x(t-2), x(t-1), x(t)] to predict [y(t)]: df= pd.read_excel('dataset.xlsx') # split a univariate dataset into train/test sets def split_dataset(data): train, test = data[:-328], data[-328:-6] return train, test train, test = split_dataset(df.values) # scale train and