theano

Vector shift (Roll) in Tensorflow

萝らか妹 提交于 2019-12-19 09:56:50
问题 Lets say, that we do want to process images (or ndim vectors) using Keras/TensorFlow. And we want, for fancy regularization, to shift each input by a random number of positions to the left (owerflown portions reappearing at the right side ). How could it be viewed and solved: 1) Is there any variation to numpy roll function for TensorFlow? 2) x - 2D tensor ri - random integer concatenate(x[:,ri:],x[:,0:ri], axis=1) #executed for each single input to the layer, ri being random again and again

Neural network accuracy optimization

匆匆过客 提交于 2019-12-19 09:25:18
问题 I have constructed an ANN in keras which has 1 input layer(3 inputs), one output layer (1 output) and two hidden layers with with 12 and 3 nodes respectively. The way i construct and train my network is: from keras.models import Sequential from keras.layers import Dense from sklearn.cross_validation import train_test_split import numpy # fix random seed for reproducibility seed = 7 numpy.random.seed(seed) dataset = numpy.loadtxt("sorted output.csv", delimiter=",") # split into input (X) and

How to run several Keras neural networks in parallel

此生再无相见时 提交于 2019-12-19 05:46:08
问题 I'm trying to use Keras to run a reinforcement learning algorithm. In this algorithm, I'm training a neural network. What's different from other learning problems is that I need to use the neural network itself to generate training data, and repeat this after it updates. I run into problem when I'm trying to generate training data in parallel. The problem is that I can't tell Theano to use GPU while training because it will also use GPU when generating training data and cause problems if

Defining a gradient with respect to a subtensor in Theano

蹲街弑〆低调 提交于 2019-12-19 05:37:10
问题 I have what is conceptually a simple question about Theano but I haven't been able to find the answer (I'll confess upfront to not really understanding how shared variables work in Theano, despite many hours with the tutorials). I'm trying to implement a "deconvolutional network"; specifically I have a 3-tensor of inputs (each input is a 2D image) and a 4-tensor of codes; for the ith input codes[i] represents a set of codewords which together code for input i. I've been having a lot of

How to set up theano config

不想你离开。 提交于 2019-12-18 12:05:39
问题 I'm new to Theano. Trying to set up a config file. First of all, I notice that I have no .theanorc file: locate .theanorc - returns nothing echo $THEANORC - returns nothing theano.test() - passes ok I'm guessing some default configuration was created wen i installed theano. Where is it? 回答1: Theano does not create any configuration file by itself, but has default values for all its configuration flags. You only need such a file if you want to modify the default values. This can be done by

pdist for theano tensor

谁说胖子不能爱 提交于 2019-12-18 04:17:55
问题 I have a theano symbolic matrix x = T.fmatrix('input') x will be later on populated by n vectors of dim d (at train time). I would like to have the theano equivalent of pdist (scipy.spatial.distance.pdist of pdist), something like D = theano.pdist( x ) How can I achieve this? Calling scipy.spatial.distance.pdist on x directly does not work as x at this stage is only symbolic... Update: I would very much like to be able to mimic pdist "compact" behavior: that is, computing only ~1/2 of the n x

pdist for theano tensor

穿精又带淫゛_ 提交于 2019-12-18 04:17:07
问题 I have a theano symbolic matrix x = T.fmatrix('input') x will be later on populated by n vectors of dim d (at train time). I would like to have the theano equivalent of pdist (scipy.spatial.distance.pdist of pdist), something like D = theano.pdist( x ) How can I achieve this? Calling scipy.spatial.distance.pdist on x directly does not work as x at this stage is only symbolic... Update: I would very much like to be able to mimic pdist "compact" behavior: that is, computing only ~1/2 of the n x

How can I assign/update subset of tensor shared variable in Theano?

≯℡__Kan透↙ 提交于 2019-12-17 23:16:39
问题 When compiling a function in theano , a shared variable(say X) can be updated by specifying updates=[(X, new_value)] . Now I am trying to update only subset of a shared variable: from theano import tensor as T from theano import function import numpy X = T.shared(numpy.array([0,1,2,3,4])) Y = T.vector() f = function([Y], updates=[(X[2:4], Y)] # error occur: # 'update target must # be a SharedVariable' The codes will raise a error "update target must be a SharedVariable", I guess that means

How can I assign/update subset of tensor shared variable in Theano?

二次信任 提交于 2019-12-17 23:03:14
问题 When compiling a function in theano , a shared variable(say X) can be updated by specifying updates=[(X, new_value)] . Now I am trying to update only subset of a shared variable: from theano import tensor as T from theano import function import numpy X = T.shared(numpy.array([0,1,2,3,4])) Y = T.vector() f = function([Y], updates=[(X[2:4], Y)] # error occur: # 'update target must # be a SharedVariable' The codes will raise a error "update target must be a SharedVariable", I guess that means

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