lstm

Understanding Tensorflow LSTM Input shape

做~自己de王妃 提交于 2019-12-18 10:42:08
问题 I have a dataset X which consists N = 4000 samples , each sample consists of d = 2 features (continuous values) spanning back t = 10 time steps . I also have the corresponding 'labels' of each sample which are also continuous values, at time step 11. At the moment my dataset is in the shape X: [4000,20], Y: [4000]. I want to train an LSTM using TensorFlow to predict the value of Y (regression), given the 10 previous inputs of d features, but I am having a tough time implementing this in

Siamese Neural Network in TensorFlow

只谈情不闲聊 提交于 2019-12-18 10:35:52
问题 I'm trying to implement a Siamese Neural Network in TensorFlow but I cannot really find any working example on the Internet (see Yann LeCun paper). The architecture I'm trying to build would consist of two LSTMs sharing weights and only connected at the end of the network. My question is: how to build two different neural networks sharing their weights (tied weights) in TensorFlow and how to connect them at the end? Thanks :) Edit : I implemented a simple and working example of a siamese

How to stack multiple lstm in keras?

那年仲夏 提交于 2019-12-18 10:05:08
问题 I am using deep learning library keras and trying to stack multiple LSTM with no luck. Below is my code model = Sequential() model.add(LSTM(100,input_shape =(time_steps,vector_size))) model.add(LSTM(100)) The above code returns error in the third line Exception: Input 0 is incompatible with layer lstm_28: expected ndim=3, found ndim=2 The input X is a tensor of shape (100,250,50). I am running keras on tensorflow backend 回答1: You need to add return_sequences=True to the first layer so that

What is the correct procedure to split the Data sets for classification problem?

岁酱吖の 提交于 2019-12-18 09:45:39
问题 I am new to Machine Learning & Deep Learning. I would like to clarify my doubt related to train_test_split before training I have a data set of size (302, 100, 5) , where, (207,100,5) belongs to class 0 (95,100,5) belongs to class 1. I would like to perform Classification using LSTM (since, sequence Data) How can i split my data set for training, since the classes do not have equal distribution sets ? Option 1 : Consider whole data [(302,100, 5) - both classes (0 & 1)] , shuffle it, train

Input Shape Error in Second-layer (but not first) of Keras LSTM

做~自己de王妃 提交于 2019-12-18 06:56:29
问题 EDITED for conciseness. I am trying to build an LSTM model, working off the documentation example at https://keras.io/layers/recurrent/ from keras.models import Sequential from keras.layers import LSTM The following three lines of code (plus comment) are taken directly from the documentation link above: model = Sequential() model.add(LSTM(32, input_dim=64, input_length=10)) # for subsequent layers, not need to specify the input size: model.add(LSTM(16)) ValueError: Input 0 is incompatible

pytorch使用cuda报错RuntimeError: CUDA error: unknown error

南笙酒味 提交于 2019-12-18 04:27:41
pytorch使用cuda报错RuntimeError: CUDA error: unknown error 加上torch.cuda.current_device() 例如 import os import torch import torch.nn as nn import argparse from sklearn import metrics from torch.utils.data import DataLoader from models import LSTM, AE_LSTM, ATAE_LSTM, PBAN from data_utils import SentenceDataset, build_tokenizer, build_embedding_matrix torch.cuda.current_device() 程序 来源: CSDN 作者: LoveLkl 链接: https://blog.csdn.net/u010327784/article/details/103586360

Shaping data for LSTM, and feeding output of dense layers to LSTM

被刻印的时光 ゝ 提交于 2019-12-17 20:59:41
问题 I'm trying to figure out the proper syntax for the model I'm trying to fit. It's a time-series prediction problem, and I want to use a few dense layers to improve the representation of the time series before I feed it to the LSTM. Here's a dummy series that I'm working with: import pandas as pd import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') import numpy as np import keras as K import tensorflow as tf d = pd.DataFrame(data = {"x": np.linspace(0, 100, 1000)}) d['l1_x'] = d.x

How do I create a variable-length input LSTM in Keras?

馋奶兔 提交于 2019-12-17 17:27:04
问题 I am trying to do some vanilla pattern recognition with an LSTM using Keras to predict the next element in a sequence. My data look like this: where the label of the training sequence is the last element in the list: X_train['Sequence'][n][-1] . Because my Sequence column can have a variable number of elements in the sequence, I believe an RNN to be the best model to use. Below is my attempt to build an LSTM in Keras: # Build the model # A few arbitrary constants... max_features = 20000 out

Understanding stateful LSTM

房东的猫 提交于 2019-12-17 15:58:07
问题 I'm going through this tutorial on RNNs/LSTMs and I'm having quite a hard time understanding stateful LSTMs. My questions are as follows : 1. Training batching size In the Keras docs on RNNs, I found out that the hidden state of the sample in i -th position within the batch will be fed as input hidden state for the sample in i -th position in the next batch. Does that mean that if we want to pass the hidden state from sample to sample we have to use batches of size 1 and therefore perform

Building Speech Dataset for LSTM binary classification

亡梦爱人 提交于 2019-12-17 14:49:17
问题 I'm trying to do binary LSTM classification using theano. I have gone through the example code however I want to build my own. I have a small set of "Hello" & "Goodbye" recordings that I am using. I preprocess these by extracting the MFCC features for them and saving these features in a text file. I have 20 speech files(10 each) and I am generating a text file for each word, so 20 text files that contains the MFCC features. Each file is a 13x56 matrix. My problem now is: How do I use this