Questions tagged [theano]
Theano is a numerical computation library for Python. Computations are expressed using a Numpy-like syntax and compiled to run efficiently on either CPU or GPU architectures. Theano uses a mathematical computational graph and optimized the graph to speed up the computations using optimized C code. As of release 1.0, Theano will no longer be actively developed.
theano
2,450
questions
153
votes
12
answers
250k
views
Deep-Learning Nan loss reasons
What would cause a Convolutional Neural Network to diverge?
Specifics:
I am using Tensorflow's iris_training model with some of my own data and keep getting
ERROR:tensorflow:Model diverged with loss =...
133
votes
28
answers
215k
views
NaN loss when training regression network
I have a data matrix in "one-hot encoding" (all ones and zeros) with 260,000 rows and 35 columns. I am using Keras to train a simple neural network to predict a continuous variable. The code to make ...
110
votes
11
answers
68k
views
How to get reproducible results in keras
I get different results (test accuracy) every time I run the imdb_lstm.py example from Keras framework (https://github.com/fchollet/keras/blob/master/examples/imdb_lstm.py)
The code contains np.random....
109
votes
6
answers
228k
views
Keras, how do I predict after I trained a model?
I'm playing with the reuters-example dataset and it runs fine (my model is trained). I read about how to save a model, so I could load it later to use again. But how do I use this saved model to ...
79
votes
6
answers
193k
views
Keras model.summary() result - Understanding the # of Parameters
I have a simple NN model for detecting hand-written digits from a 28x28px image written in python using Keras (Theano backend):
model0 = Sequential()
#number of epochs to train for
nb_epoch = 12
#...
69
votes
7
answers
76k
views
Convert Keras model to C++ [closed]
I am using Keras (with Theano) to train my CNN model. Does anyone has idea how can I use it in my C++ application? Does anyone tried something similar? I have idea to write some python code that will ...
64
votes
8
answers
184k
views
How do I install Keras and Theano in Anaconda Python on Windows?
I am trying to work on neural networks in Python using the following Keras packages:
from keras.utils import np_utils
from keras.layers.core import Dense, Activation, Dropout
from keras.models import ...
64
votes
8
answers
83k
views
How to compute Receiving Operating Characteristic (ROC) and AUC in keras?
I have a multi output(200) binary classification model which I wrote in keras.
In this model I want to add additional metrics such as ROC and AUC but to my knowledge keras dosen't have in-built ROC ...
62
votes
20
answers
171k
views
Keras accuracy does not change
I have a few thousand audio files and I want to classify them using Keras and Theano. So far, I generated a 28x28 spectrograms (bigger is probably better, but I am just trying to get the algorithm ...
62
votes
5
answers
91k
views
What is the number of filter in CNN?
I am currently seeing the API of theano,
theano.tensor.nnet.conv2d(input, filters, input_shape=None, filter_shape=None, border_mode='valid', subsample=(1, 1), filter_flip=True, image_shape=None, **...
61
votes
6
answers
98k
views
What is the correct way to change image channel ordering between channels first and channels last?
I can not for the life of me figure out how to switch the image ordering. images are read in (x,x,3) format, theano requires it to be in (3,x,x) format. I tried changing the order with
numpy.array([...
56
votes
10
answers
86k
views
How to switch Backend with Keras (from TensorFlow to Theano)
I tried to switch Backend with Keras (from TensorFlow to Theano) but did not manage.
I followed the temps described here but it doesn't work. I created a keras.json in the keras' directory (as it did ...
55
votes
8
answers
141k
views
How to plot a chart in the terminal
I'm researching ML/Theano, and recently came across this script: https://gist.github.com/notmatthancock/68d52af2e8cde7fbff1c9225b2790a7f which was cool to play with. And like all ML researchers, I ...
53
votes
2
answers
37k
views
Calling "fit" multiple times in Keras
I've working on a CNN over several hundred GBs of images. I've created a training function that bites off 4Gb chunks of these images and calls fit over each of these pieces. I'm worried that I'm only ...
47
votes
2
answers
44k
views
Getting gradient of model output w.r.t weights using Keras
I am interested in building reinforcement learning models with the simplicity of the Keras API. Unfortunately, I am unable to extract the gradient of the output (not error) with respect to the weights....
46
votes
1
answer
7k
views
Keras not using multiple cores
Based on the famous check_blas.py script, I wrote this one to check that theano can in fact use multiple cores:
import os
os.environ['MKL_NUM_THREADS'] = '8'
os.environ['GOTO_NUM_THREADS'] = '8'
os....
44
votes
4
answers
43k
views
What is the definition of a non-trainable parameter?
What is the definition of non-trainable parameter in a model?
For example, while you are building your own model, its value is 0 as a default, but when you want to use an inception model, it is ...
44
votes
3
answers
86k
views
Keras: How to get layer shapes in a Sequential model
I would like to access the layer size of all the layers in a Sequential Keras model. My code:
model = Sequential()
model.add(Conv2D(filters=32,
kernel_size=(3,3),
...
42
votes
3
answers
35k
views
Activation function after pooling layer or convolutional layer?
The theory from these links show that the order of Convolutional Network is: Convolutional Layer - Non-linear Activation - Pooling Layer.
Neural networks and deep learning (equation (125)
Deep ...
41
votes
5
answers
33k
views
theano - print value of TensorVariable
How can I print the numerical value of a theano TensorVariable?
I'm new to theano, so please be patient :)
I have a function where I get y as a parameter.
Now I want to debug-print the shape of this ...
40
votes
3
answers
24k
views
Keras uses way too much GPU memory when calling train_on_batch, fit, etc
I've been messing with Keras, and like it so far. There's one big issue I have been having, when working with fairly deep networks: When calling model.train_on_batch, or model.fit etc., Keras ...
38
votes
5
answers
46k
views
How to set up theano config
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
...
37
votes
1
answer
11k
views
Unsupervised pre-training for convolutional neural network in theano
I would like to design a deep net with one (or more) convolutional layers (CNN) and one or more fully connected hidden layers on top.
For deep network with fully connected layers there are methods in ...
36
votes
12
answers
50k
views
How to change Keras backend (where's the json file)?
I have installed Keras, and wanted to switch the backend to Theano. I checked out this post, but still have no idea where to put the created json file. Also, below is the error I got when running ...
32
votes
9
answers
18k
views
Keras verbose training progress bar writing a new line on each batch issue
running a Dense feed-forward neural net in Keras.
there are class_weights for two outputs, and sample_weights for a third output. fore some reason it prints the progress verbose display for each batch ...
31
votes
2
answers
26k
views
Use of None in Array indexing in Python
I am using the LSTM tutorial for Theano (http://deeplearning.net/tutorial/lstm.html). In the lstm.py (http://deeplearning.net/tutorial/code/lstm.py) file, I don't understand the following line:
c = ...
30
votes
13
answers
41k
views
Keras: "RuntimeError: Failed to import pydot." after installing graphviz and pydot
I'm using Anaconda Python 2.7 on windows 10
I was planning on doing Keras visualization so (whilst spyder was open) I opened the Anaconda command prompt and pip installed graphviz and pydot. Now when ...
29
votes
6
answers
73k
views
Package installed by Conda, Python cannot find it
I try to install Theano by Anaconda. It works, but when I enter the python -i, import theano shows No module named 'theano'. Do I need to switch another interpreter of Python, how? Also, for the ...
28
votes
3
answers
4k
views
Theano with Keras on Raspberry Pi
I am trying to get Theano to run with Keras on a Raspberry Pi 3 (B) without success. I tried Ubuntu MATE and Raspbian as operating systems, without success. To install Theano and Keras, I have taken ...
27
votes
3
answers
41k
views
Install Cuda without root
I know that I can install Cuda with the following:
wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run
chmod +x cuda_7.0.28_linux.run
./cuda_7.0....
27
votes
4
answers
48k
views
How to install Theano on Anaconda Python 2.7 x64 on Windows?
I wonder how to install Theano on Anaconda Python 2.7 x64 on Windows 7 x64. The Theano website provides some instructions but is not clear as to what is specific to Anaconda.
26
votes
5
answers
16k
views
Python: rewrite a looping numpy math function to run on GPU
Can someone help me rewrite this one function (the doTheMath function) to do the calculations on the GPU? I used a few good days now trying to get my head around it but to no result. I wonder maybe ...
25
votes
2
answers
15k
views
How can I assign/update subset of tensor shared variable in Theano?
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 ...
25
votes
1
answer
13k
views
input dimensions to a one dimensional convolutional network in keras
really finding it hard to understand the input dimensions to the convolutional 1d layer in keras:
Input shape
3D tensor with shape: (samples, steps, input_dim).
Output shape
3D tensor with shape: (...
24
votes
4
answers
43k
views
Is it possible to activate virtualenv in Google-colab? (/bin/sh: 1: source: not found)
I am trying to install theano in Google Colab for testing. I have installed virtualenv and created an environment:
!pip3 install virtualenv
!virtualenv theanoEnv
But am not able to activate the ...
23
votes
2
answers
9k
views
Policy Gradients in Keras
I've been trying to build a model using 'Deep Q-Learning' where I have a large number of actions (2908). After some limited success with using standard DQN:
(https://www.cs.toronto.edu/~vmnih/docs/dqn....
22
votes
12
answers
67k
views
How to uninstall Keras?
I have installed Keras using this command:
sudo pip install keras
It installed properly and worked fine until I tried to import application modules:
from keras.applications.vgg16 import VGG16
Using ...
21
votes
3
answers
55k
views
keras - cannot import name Conv2D
I recently got the deep learning docker from https://github.com/floydhub/dl-docker running and while trying out the tutorials, received an error when importing the keras layers module.
from ...
21
votes
2
answers
6k
views
Purpose of 'givens' variables in Theano.function
I was reading the code for the logistic function given at http://deeplearning.net/tutorial/logreg.html. I am confused about the difference between inputs & givens variables for a function. The ...
21
votes
2
answers
2k
views
Implementing sparse connections in neural network
Some use cases for neural networks requires that not all neurons are connected between two consecutive layers. For my neural network architecture, I need to have a layer, where each neuron only has ...
21
votes
1
answer
905
views
3d sliding window operation in Theano?
TL.DR. Is there a 3-dimensional friendly implementation of theano.tensor.nnet.neighbours.images2neibs?
I would like to perform voxel-wise classification of a volume (NxNxN) using a neural network ...
20
votes
1
answer
771
views
Numpy installation error. (Mingw32CCompiler instance has no attribute 'compile_options')
I use python with windows8 / anaconda spyder (2.7)
I'm trying to update Theano up-to-date. When I installing the theano by
"pip install --upgrade theano"
The error happens at numpy installation ...
19
votes
2
answers
13k
views
How to find wrong prediction cases in test set (CNNs using Keras)
I'm using MNIST example with 60000 training image and 10000 testing image. How do I find which of the 10000 testing image that has an incorrect classification/prediction?
18
votes
6
answers
34k
views
theano g++ not detected
I installed theano but when I try to use it I got this error:
WARNING (theano.configdefaults): g++ not detected! Theano will be unable to execute
optimized C-implementations (for both CPU and ...
18
votes
1
answer
2k
views
Using Deep Learning to Predict Subsequence from Sequence
I have a data that looks like this:
It can be viewed here and has been included in the code below.
In actuality I have ~7000 samples (row), downloadable too.
The task is given antigen, predict the ...
18
votes
1
answer
15k
views
Will dropout automatically be deactivated in Keras model?
I have trained a model in Keras. The model contains dropout layers and I want to be absolutely sure nothing is dropped when doing this.
According to the documentation, a layer's output can be ...
17
votes
1
answer
11k
views
Neural Network Ordinal Classification for Age
I have created a simple neural network (Python, Theano) to estimate a persons age based on their spending history from a selection of different stores. Unfortunately, it is not particularly accurate.
...
17
votes
3
answers
7k
views
How can I change device used of theano
I tried to change the device used in theano-based program.
from theano import config
config.device = "gpu1"
However I got error
Exception: Can't change the value of this config parameter after ...
16
votes
3
answers
14k
views
Why is the convolutional filter flipped in convolutional neural networks? [closed]
I don't understand why there is the need to flip filters when using convolutional neural networks.
According to the lasagne documentation,
flip_filters : bool (default: True)
Whether to flip ...
16
votes
2
answers
7k
views
Is there a common format for neural networks
Different teams use different libraries to train and run neural networks (caffe, torch, theano...). This makes sharing difficult: each library has its own format to store networks and you have to ...