Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Keras is a minimalist, highly modular neural network library written in Python.

0
votes
1answer
15 views

When memory errors occur with model.fit(), is it due to GPU RAM or normal RAM?

With respect to this question, https://stackoverflow.com/questions/51895278/how-to-know-when-to-use-fit-generator-in-keras-when-training-data-gets-too-big when memory errors are reported due to ...
0
votes
0answers
7 views

How many actual cells are there in an RNN?

AFAIK, there are 4 different types of RNNs based on their application. And these are identified by the size of input sequences they accept and size of output sequences they generate: ...
0
votes
0answers
3 views

Is it a good practice to always apply `ReduceLROnPlateau()`, given that models benefit from reducing learning rate once learning stagnates?

The rationale behind the keras function ReduceLROnPlateau() is that models benefit from reducing learning rate once learning stagnates. Is it a good practice to ...
1
vote
0answers
7 views

Understanding the effect of num_words of Tokenizer in Keras

Consider the following code: ...
1
vote
0answers
12 views

Input data for this dataset to be feed into keras for training

Suppose I have 3 csv files which forms the dataset for training a machine learning model in Keras. file1.csv ...
0
votes
1answer
7 views

Can I use fit() function with images in Keras?

I want to use vgg16 to train a dataset that contains images. Can I use fit() function instead of fit_generator() in Keras? How?...
1
vote
0answers
12 views

How to implement YOLO in my CNN model?

I build a CNN model using keras on the cat vs dog dataset. Now what I want is with the image classification my model should also locate that animal on that image. I searched on web and found that YOLO ...
0
votes
0answers
23 views

how to check the classes the keras classifier/Neural Network is trained on?

I have trained a CNN using keras for Image classification with 3 classes. The results are bad and I'm trying to understand what the classifier has learnt and what it has not. It's only giving me an ...
0
votes
2answers
20 views

Custom conditional Keras metric

I am trying to create the following metric for my neural network using keras $$ s = \left\{ \begin{array}{ll} \sum_{i=1}^{n} e^{\frac{-d_i}{10}}-1 & \quad d < 0 \\ ...
0
votes
1answer
20 views

Multiple Regression Outputs from neural networks [on hold]

I have a regression problem which I have to predict 10 numerical values from a provided data. For example let's say I have a data set containing `X1, X2, X3, X4, X5, X6 ...2001Q1 ,2001Q2 ,2001Q3 ,...
0
votes
1answer
13 views

Keras backend function equivalent for str.format [on hold]

How to perform the following function using Keras backend? "{0:b}".format(37)
8
votes
4answers
2k views

Why does adding a dropout layer in Keras improve machine learning performance, given that dropout suppresses some neurons from the model?

If removing some neurons result in a better performing model, why not use a simpler neural network with fewer layers, fewer neurons in the first place? Why build a bigger, more complicated model in ...
1
vote
2answers
17 views

CNN, which layer to choose for a similarity measure

I built a model (InceptionResnet v2) to classify images and I would like to use it to measure similarity between objects. One way to measure that similarity is to catch an intermediate layer's ...
1
vote
0answers
12 views

K-fold cross validation when using fit_generator and flow_from_directory() in Keras

I am using flow_from_directory() and fit_generator in my deep learning model, and I want to use cross validation method to train ...
1
vote
1answer
14 views

Is it appropriate to use polar images as input to CNNs? Or must they be Cartesian transformed first?

I have built a convolutional neural net which trains on data originally represented in polar space (measurements are a function of angle and distance). My pipeline begins by converting coordinates to ...
2
votes
1answer
22 views

Please explain input shape in Keras

My data consist of 2-dimentional arrays with shape (2,3) The whole dataset emp consist of 12 items (I know that it is too small number for an NN training, but it is just a test), so it has shape (12,2,...
0
votes
1answer
17 views

learning rate very low 1e-5 for Adam optimizer good practice?

I am used to of using learning rates 0.1 to 0.001 or something, now i was working on a siamese net work with sonar images. Was training too fast, overfitting after just 2 epochs. I tried to slow the ...
1
vote
0answers
19 views

same model gives different values

I built a MLP for classification problem. I used KDD99 dataset. but the problem is that when I run it it gives ech time a different value of accuracy. Is this logic? I mean could the same model for ...
0
votes
0answers
7 views

RNN model with 3 hidden layers

In a paper, it mentioned: ANN, RNN, and LSTM NN are optimized to contain three hidden layers with 1000 hidden units in each layer. I would like to model the RNN model in Keras. But my code fails in ...
0
votes
0answers
5 views

Find a most relevant geopoint from given set of points with parameters [closed]

I have a task to get most probable geolocations for text articles. I do not need to program any NLP, because I use OpenCalais API for this part of task. After I get entities from OpenCalais I filter ...
0
votes
1answer
15 views

Is regularization included in loss history Keras returns?

I'm getting to know Keras. Right now, I'm testing with regularization and how to use them. Comparing the results of loss history for a training session with and without regularization, it seems to me ...
0
votes
2answers
17 views

Preprocessing of Sudoku Dataset from Kaggle

Dataset: https://www.kaggle.com/bryanpark/sudoku I would like to create a neural network for this Dataset. Feature: ...
0
votes
0answers
6 views

How can I prevent LSTM-based model from repeating the same token in decoding?

I'm working on a word-level translation model based on a Keras example but my output looks like [it you you you you you it it it the the are]. My training loss is ...
2
votes
1answer
14 views

Why use two LSTM layers one after another?

In the example on the Keras site, seq2seq_translate.py on line 189, there is a LSTM layer after another (the first with return_sequences=True), but another example ...
1
vote
2answers
14 views

Setting batch size: training requires twice as much memory as validating

I am using Keras with a Tensorflow backend to train an Image Classification model on a GPU. I have read somewhere that training uses roughly twice (both forward and back props) the GPU memory of ...
1
vote
1answer
24 views

How to utilize user survey answers and the actual usage in forecasting power usage using LSTM?

I have the pre-trial survey and post-trial survey conducted of around 5000 users for Smart Meter installation. With this I have power usage reading recorded every 30 min for around one and a half ...
1
vote
0answers
16 views

using deep learning with kares to produce ANN model Error: could not convert string to float: '2014-04-02 17:50:04'

i am trying to fit a model a using deep learning with kares to produce ANN model using the following code Load libraries ...
2
votes
1answer
26 views

Why this model does not converge in keras?

This case has an underlying story but I have essentially boiled it down to the simplest possible re-producible example I could. Essentially let us think that I have up to 1000 nodes and each node ...
2
votes
1answer
23 views

To continue training an existing tensorflow model do I need to restore the session?

I'm trying to work out the best way to integrate with EC2 spot instances that can be started and stopped. Do I need to store the tf.session or can I just do ...
0
votes
0answers
9 views

Why my Simple DL model with default SGD working very poorly in keras?

When I'm answering questions in StackOverflow, I found this question about the poor performance of DL model. I tried to implement the same code in my machine to see whats happening. I have also ...
3
votes
1answer
20 views

Relationship between batch size and the number of neurons in the input layer

Regarding LSTM neural networks, I am unable to understand the relationship between batch size, the number of neurons in the input layer and the number of "variables" or "columns" in the input. (...
0
votes
0answers
10 views

Stopping training if accuracy is below x at epoch y

In addition to the basic early stopping features in KERAS, I would like to stop training if the validation accuracy is still below 0.80 at epoch 40. How can I do that?
1
vote
1answer
28 views

Is there an implementation of pocket algorithm in Keras?

As explained in Wikipedia, the pocket algorithm is a very simple variant/addition of/to ANN which keeps a copy of the best model seen so far and returns that one as the trained model (instead of the ...
2
votes
0answers
15 views

Validation loss keeps fluctuating about training loss

I am training a Keras model for multi-target regression by using a custom loss function with the goal of getting predictions accurate to below 0.01 with respect to ...
0
votes
0answers
10 views

Problem with pydot and graphviz on AWS Sagemaker

I'm trying to plot_model to visualize my NN built in Keras on AWS sagemaker (using Python on a Jupyter notebook). I used the jupyter terminal to ...
1
vote
0answers
14 views

Applying LIME to a regression Keras model with categorical variables

I have trained a simple Neural Network with 64 categorical features. This is a Q-learning model with 4 outputs each corresponding to an action reward. I'm trying to explain the best action (maximum ...
3
votes
1answer
25 views

LSTM training/prediction with no starting sequence

ML newbie here. As an exercise, I'm trying to build a character based language model based on a simple 1 layer LSTM. Based on what I've learned about LSTMs, a common usage is to take in a sequence of ...
2
votes
2answers
55 views

What is the logic of the epoch?

What is the logic of the epoch? for example, 1 time, 2 times ... I just do not know what else is working to give better results than I know.
1
vote
0answers
23 views

Multivariable time-series forecast with NN vs RNN

I am doing some comparison of RNN with other methodologies to check if the RNNs can improve some more "classical" models. In fact, I am doing it with multiple features (similar to what was done here) ...
1
vote
1answer
43 views

Using class weights in Keras with multiple binary outputs which are not simply one-hot-encoded

My labels are binary vectors of length 5, e.g., [0, 0, 1, 1, 1]. My label set is very biased, 1-to-50, where the case [0, 0, 0, 0, 0] is very common while all ...
0
votes
1answer
13 views

why this naming convention for padding as “Same” and “Valid” in keras

I was going through CNN's and found that padding argument should be set to "Valid" if i need no padding and "Same" if i need padding. But, it doesn't make any sense to me. Why can't keras development ...
0
votes
0answers
6 views

Keras mulilabel classification loss function: how to get accurate val_acc using binary crossentropy?

I am following this tutorial on multilabel-classification using keras https://www.depends-on-the-definition.com/classifying-genres-of-movies-by-looking-at-the-poster-a-neural-approach/ Here it is ...
0
votes
0answers
19 views

LSTM: different number of rows at each time step

I have for each of the years N-k, ..., N a different data set. The data sets have the same number of columns but a different number of rows. The columns have the same meanings in the different ...
0
votes
0answers
12 views

Keras: calculate sample_weight? -> accuracy plot wild ups/downs?

I'm on a sequence labeling problem where each word of a sentence should be classified into one of 3 classes (which are one-hot encoded). No generator used. However, one of the 3 classes is naturally ...
2
votes
1answer
32 views

Convolution neural network with 11 million parameters unable to overfit on 100 image samples

I have been trying to do some sort of image enhancement on grayscale images. I have used both pixel wise loss and perceptual loss (perceptual loss uses classifier between 2 classes trained on the same ...
0
votes
2answers
31 views

What does the output of model.predict function from Keras mean?

I have built a LSTM model to predict duplicate questions on the Quora official dataset. The test labels are 0 or 1. 1 indicates the question pair is duplicate. After building the model using ...
0
votes
0answers
9 views

Run custom code when new Keras ModelCheckPoint is saved

When saving a ModelCheckPoint, with save_best_only=True, is it possible to somehow trigger a callback, or verify whether a new model is saved in order to trigger some custom code? ...
0
votes
1answer
14 views

Keras cNN Transfer Model: Reduce Final Model Size?

I'm working with multiple cNNs to be ran on mobile devices. If I create these cNNs from scratch (black n white, 256x256), I'm able to produce a binary classification model of about 10mb, which is a ...
4
votes
2answers
52 views

overfit random walk using ANN in Keras

I am trying to build a neural net that will overfit random walk path. So, far I wasn't able to get a neural net that we shatter/overfit. I was wondering which parameters I should explore, or which ...