Using TensorFlow with Intel GPU

Is there any way now to use TensorFlow with Intel GPUs? If yes, please point me in the right direction. If not, please let me know which framework, if any, (Keras, Theano, etc) can I use for my Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller.
Category: Data Science

Stuck on deconvolution in Theano and TensorFlow

I'm captivated by autoencoders and really like the idea of convolution. It seems though that both Theano and TensorFlow only support conv2d to go from an array of 2D-RGB (n 3D arrays) to an array of higher-depth images. That makes sense from the traditional tensor-product math, c_ijkl = sum{a_ijk*b_klm}, but means it's hard to 'de-convolve' an image. In both cases, if I have an image (in #batch, depth, height, width form), I can do a conv to get (#batch, num_filters, …
Category: Data Science

Convolutional Neural Network not learning EEG data

I have trained a simple CNN (using Python + Lasagne) for a 2-class EEG classification problem, however, the network doesn't seem to learn. loss does not drop over epochs and classification accuracy doesn't drop from random guessing (50%): Questions Is there anything wrong with the code that is causing this? Is there a better (more correct?) way to handle EEG data? EEG setup Data is collected from participants completing a total of 1044 EEG trials. Each trial lasts 2 seconds …
Category: Data Science

Image as input and output in keras

I am trying to make a model of this image. Here is the relevant code: base_model = VGG16(weights='imagenet') conv4_3, conv3_3, conv2_2, conv1_2 = base_model.get_layer('block4_conv3').output, base_model.get_layer('block3_conv3').output, base_model.get_layer('block2_conv2').output, base_model.get_layer('block1_conv2').output # Use the output of the layers of VGG16 on x in the model conv1 = Convolution2D(256, 1, 1, border_mode='same')(BatchNormalization()(conv4_3)) conv1_scaled = resize(conv1, 56) . . . conv5 = Convolution2D(3, 3, 3, border_mode='same')(merge([ip_img, conv4], mode='sum')) op = Convolution2D(2, 3, 3, border_mode='same')(conv5) for layer in base_model.layers: layer.trainable = False model = Model(input=base_model.input, output=op) model.compile(optimizer='sgd', …
Category: Data Science

shape of theano tensor variable out of keras Conv2D

Being new to theano, pls bear with me. I thought the shape of the tensor variable is already well defined out of the Conv2D layer since the input is specified, as follow, from keras.layers import Input, Convolution2D import theano input_img = Input(shape=(1, 28, 28)) x = Convolution2D(16, 3, 3, activation='relu', border_mode='same') (input_img) print type(x) print theano.tensor.shape(x) But the output is, <class 'theano.tensor.var.TensorVariable'> Shape.0 Since I'm taking the default stride of 1, and same border mode here means that padding is …
Category: Data Science

Implementing Dropout for Recurrent Layers in Keras + Theano

I am looking to implement recurrent dropout (where recurrent connections between memory units of a recurrent layer such as LSTM/GRU/RNN are randomly set to 0) in Keras 2.3.1 on Theano backend on Python 3.6. As of Keras 2.1.3, dropout for recurrent layers are no longer supported for the Theano backend: Documenting this change further: the motivation for removing this feature in Theano is simply that although it would be technically possible to make it work, it would be hacky, i.e. …
Category: Data Science

Error on multitask neural nets where all outputs not observed for every example

Let's say I have 2 datasets, each from a set of experiments. Dataset A measures a set of properties X for set S, while dataset B measures properties Y for set T. X and Y are highly correlated, and S and T have (not perfect) overlap. To give an example, I might have A | ID | pKa | log P | cid12 | 3.51 | 1.2 | cid51 | 2.32 | .9 B | ID | Pol Srf A| …
Category: Data Science

Keras Import Error

While importing keras (from keras.models import Sequential), I am getting the following error: Traceback (most recent call last): File "/home/afzal/Deep cnn/cnn_deeplearningpgm/keras_cnn_new3.py", line 2, in <module> import keras File "/usr/local/lib/python2.7/dist-packages/Keras-1.1.0-py2.7.egg/keras/__init__.py", line 2, in <module> from . import backend File "/usr/local/lib/python2.7/dist-packages/Keras-1.1.0-py2.7.egg/keras/backend/__init__.py", line 29, in <module> _config = json.load(open(_config_path)) File "/usr/lib/python2.7/json/__init__.py", line 291, in load **kw) File "/usr/lib/python2.7/json/__init__.py", line 339, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode obj, …
Topic: json keras theano
Category: Data Science

Keras: How to normalize dataframe with continuous and categorical data?

I have a dataframe with about 50 columns. The columns are either categorical or continuous data. The continuous data can be between 0.000001-1.00000 or they can be between 500,000-5,000,000. The categorical data is usually a name, for example a store name. How can I normalize this data so that I can feed it into a dense layer of a Sequential model? The Y values are either 0 or 1, so it is a binary classification problem. I am currently normalizing …
Category: Data Science

How Int8 (byte) operations can be useful for deep learning?

Nvidia is planing to add hardware support for int8 operations to their titan card and target deep learning. I am trying to understood how its useful and what types of network will benefit from this. I know that FP16 instead of FP32 is what should be useful for DL, but not sure how int8 could do. There are some research that you can train with full FP32 precision and then round it to one byte - but this does not …
Category: Data Science

Communication between Keras and Backend like Tensorflow, Theano

Keras is a high level neural network API providing python library which uses tensor flow or theano or cntk as backend. What are the primary roles of backend libraries? Is it implementation? or Is it computational heavylifting using GPU, threading etc? I couldn't find any good resources online to understand how keras interacts with tensor flow or theano(backend) session. Any such resource or direction for understanding interaction is helpful !
Category: Data Science

Linear regression NN in Theano using List

I am quite new to Theano, while having used Neural Networks in MATLAB before. I have succeeded with reading all my data from my excel files, and create the input and output lists. To separate each group, both in input and output, I have created a list that contains lists : input = [[1 , 2 , 2 ], [5 , 5 ,2], [7 ,8 ,8], [7 ,1 ,1]] The same goes for output. So my Input[i] correlates the output[i]. …
Category: Data Science

Functions with state

I'm quite new to Theano and was reading the deep learning documentation here : deep learning Theano The function called accumulator with "inc" and state was explained really unclear, that I couldn't figure it out what happens that while the input is just one scalar, but you have both state and inc that have to be defined in the function definition. What happens every time you introduce a new number to the function?!!!
Category: Data Science

Keras/Theano custom loss calculation - working with tensors

I'm struggling to write some tensor manipulation code for a custom loss function I'm using in Keras. Basically, I'm trying to modify a binary_crossentropy loss by adding a weight that is calculated from a particular feature. First thing I do is pass in my extra feature data to the custom loss by appending it to the y_true like this: y_trainModded = numpy.append(y_train, MyExtraData, axis=1) Which is then passed to the fit function like: model.fit(X_train, y_trainModded, epochs=2500, .....) Then extracted to …
Category: Data Science

Make Keras run on multi-machine multi-core cpu system

I'm working on Seq2Seq model using LSTM from Keras (using Theano background) and I would like to parallelize the processes, because even few MBs of data need several hours for training. It is clear that GPUs are far much better in parallelization than CPUs. At the moment, I only have CPUs to work with. I could access 16 CPUs(2 Threads per core X 4 cores per socket X 2 sockets) From the doc of multi-core support in Theano, I managed …
Category: Data Science

Convolutional layer dropout layer in keras

According to classical paper http://www.cs.toronto.edu/~rsalakhu/papers/srivastava14a.pdf dropout operation affects not only training step but also test step - we need to multiply all neuron output weights by probability p. But in keras library I found the following implementation of dropout operation: retain_prob = 1. - level ... random_tensor = rng.binomial(x.shape, p=retain_prob, dtype=x.dtype) ... x *= random_tensor x /= retain_prob return x (see https://github.com/fchollet/keras/blob/master/keras/backend/theano_backend.py) Why x is divided by retain_prob while it should be multiplied? Or I'm just confused, and multiplying weights …
Category: Data Science

Recurrent Neural Network on Panel Data

There are 2 parts to this question. Suppose we are looking at sales $S$ of a product across $> 1000$ stores where a it sells. For each of these $1000$ stores we have 24 months recorded data. We want to be able to predict $S_t \leftarrow f(S_{t-1})$. We could build a RNN for each of the store time series, calculate test RMSE and then take an average after taking care of normalizing values etc. But the problem is there are …
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.