theano

Dimensions not matching in keras LSTM model

大兔子大兔子 提交于 2019-12-10 18:04:48
问题 I want to use an LSTM neural Network with keras to forecast groups of time series and I am having troubles in making the model match what I want. The dimensions of my data are: input tensor: (data length, number of series to train, time steps to look back) output tensor: (data length, number of series to forecast, time steps to look ahead) Note: I want to keep the dimensions exactly like that, no transposition. A dummy data code that reproduces the problem is: import numpy as np from keras

Multi-dimensional regression with Keras

那年仲夏 提交于 2019-12-10 17:06:39
问题 I want to use Keras to train a neural network for 2-dimensional regression. My input is a single number, and my output has two numbers: model = Sequential() model.add(Dense(16, input_shape=(1,), kernel_initializer=initializers.constant(0.0), bias_initializer=initializers.constant(0.0))) model.add(Activation('relu')) model.add(Dense(16, input_shape=(1,), kernel_initializer=initializers.constant(0.0), bias_initializer=initializers.constant(0.0))) model.add(Activation('relu')) model.add(Dense(2,

Tutorial for installing numpy with OpenBLAS on Windows

断了今生、忘了曾经 提交于 2019-12-10 15:56:35
问题 Please, I do need a light here. I want to install numpy using a good BLAS/LAPACK lib on Windows , but absolutely no page explains the process well enough. It seems OpenBLAS is a good and fast option. The goal is to use "theano" with "keras", and "theano" requires that the libraries be "dynamic", not static. (Not sure I understand what that means, but it causes slowness and memory issues) Please treat me as a complete newbie. Give me a step by step tutorial on how to do it! Don't forget to

Error while using Conv2DLayer with lasagne NeuralNet

£可爱£侵袭症+ 提交于 2019-12-10 15:55:44
问题 I have windows 8.1 64bit and use recommended here http://deeplearning.net/software/theano/install_windows.html#installing-theano python win-python distribution (python 3.4). I've went through every step of tutorial (excluding CUDA stuff and GPU config), uninstalled everything and did it again but my problem persists. I am trying to build convolutional neural network using Lasagne. Every layer I've tested so far is working - only Conv2DLayer throws errors. Code is as follows: net2 = NeuralNet(

Updating part of a shared variable in Theano

无人久伴 提交于 2019-12-10 15:45:56
问题 How to update part of a shared variable in Theano? E.g. instead of doing: gradient_W = T.grad(cost,W) updates.append((W, W-learning_rate*gradient_W)) train = th.function(inputs=[index], outputs=[cost], updates=updates, givens={x:self.X[index:index+mini_batch_size,:]}) I'd like to only update part of W , e.g. only the first column: updates.append((W[:, 0], W[:, 0]-learning_rate*gradient_W)) But doing so gives the error TypeError: ('update target must be a SharedVariable', Subtensor{::, int64}

Keras - Text Classification - LSTM - How to input text?

谁说我不能喝 提交于 2019-12-10 14:24:39
问题 Im trying to understand how to use LSTM to classify a certain dataset that i have. I researched and found this example of keras and imdb : https://github.com/fchollet/keras/blob/master/examples/imdb_lstm.py However, im confused about how the data set must be processed to input. I know keras has pre-processing text methods, but im not sure which to use. The x contain n lines with texts and the y classify the text by happiness/sadness. Basically, 1.0 means 100% happy and 0.0 means totally sad.

Name conflicting in Theano

半世苍凉 提交于 2019-12-10 14:24:06
问题 I am trying to import theano in a module, but I am getting a traceback: File "/media/tarun/6A86CA8286CA4DEF/develop/pydy/pydy/codegen/code.py", line 16, in <module> import theano File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 44, in <module> from theano.gof import \ File "/usr/local/lib/python2.7/dist-packages/theano/gof/__init__.py", line 38, in <module> from theano.gof.cc import \ File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 55, in <module>

Loop over (or vectorize) variable length matrices in Theano

早过忘川 提交于 2019-12-10 14:23:52
问题 I have a list of matrices L , where each item M is a x*n matrix ( x is a variable, n is a constant). I want to compute the sum of M'*M for all items in L ( M' is the transpose of M ) as the following Python code does: for M in L: res += np.dot(M.T, M) Actually I want to implement this in Theano (which doesn't support variable length multidimensional arrays), and I don't want to pad all matrices to the same size because that will waste too much space (some of the matrices can be very large).

IndexError: fail to coerce slice entry of type tensorvariable to integer

会有一股神秘感。 提交于 2019-12-10 13:28:53
问题 I run "ipython debugf.py" and it gave me error message as below IndexError Traceback (most recent call last) /home/ml/debugf.py in <module>() 8 fff = theano.function(inputs=[index], 9 outputs=cost, ---> 10 givens={x: train_set_x[index: index+1]}) IndexError: failed to coerce slice entry of type TensorVariable to integer" I search the forum and no luck, is there someone can help ? thanks! debugf.py : import theano.tensor as T import theano import numpy index =T.lscalar() x=T.dmatrix() cost=x

Can not update a subset of shared tensor variable after a cast

百般思念 提交于 2019-12-10 10:58:32
问题 I have the following code: import theano.tensor as T Words = theano.shared(value = U, name = 'Words') zero_vec_tensor = T.vector() zero_vec = np.zeros(img_w, dtype = theano.config.floatX) set_zero = theano.function([zero_vec_tensor], updates=[(Words, T.set_subtensor(Words[0,:], zero_vec_tensor))]) Which is compiling fine (where U is a numpy array of dtype float64 ). To prevent future type error I want to cast my shared tensor Words into float32 (or theano.config.floatX which is equivalent as