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

Questions tagged [keras]

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

1
vote
0answers
9 views

Understanding LSTM structure

I am trying to learn LSTM's, and struggling a bit with the structure and the inputs/outputs of LSTM layers. Say I have a network definition like this: ...
1
vote
0answers
7 views

Keras regression adding model depth

I am experimenting in keras (without really knowing what I am doing) with adding in model depth, and when I attempt this I get an error: ...
2
votes
1answer
20 views

Is a good shuffle random state for training data really good for the model?

I'm using keras to train a binary classifier neural network. To shuffle the training data I am using shuffle function from scikit-learn. I observe that for some shuffle_random_state (seed for ...
2
votes
0answers
19 views

K-fold cross validation of scikit-learn with confusion matrix of Keras

I intend to display confusion matrix using Keras while K-fold of scikit-learn. My code using Keras is: ...
1
vote
0answers
12 views

How to shape one-hot data for keras lstm

I am trying to learn how to make an LSTM in keras and I was having difficulty working out what input dimensions the data needs to be for the cudnnlstm layer. Each time I try to alter the input_shape I ...
1
vote
0answers
10 views

Contrastive loss problem in a character-level, siamese NN model

Summary: my NN with contrastive loss does not work, need help debugging Background: I am trying to replicate this paper At first, I used binary crossentropy for loss, and the results were very good,...
2
votes
0answers
10 views

Sequence to sequence LSTM is “slow” to observe changes. Can this be improved?

I have some multivariate time series, and I'm trying to teach an LSTM with simulated data what is good and what is bad, so the input is a timeseries with a label for every timestep, i.e. [1,1,1,1,1,1,...
1
vote
0answers
12 views

How to add three csv file into one LSTM using python

I have three csv files with same inputs but values are different. I want to add these three csv file into one LSTM model to predict value. Hare I upload the three different csv file and my LSTM code....
1
vote
0answers
9 views

Is it possible to set GPU affinity for a mixed precision NN, with FP32 and FP16 going to different GPUs? [migrated]

I have a GTX 1080 and an RTX 2080. I want to train using both, but since the RTX can handle FP16 twice as fast, I'd like to set it up so that the training is multi-GPU and the RTX handles the FP16 ...
1
vote
1answer
16 views

Effect of adding gaussian noise to the input layer in a CNN

I often come across Keras code that adds GaussianNoise to the input, however its not clear to me what advantages does it offer to the learning. ...
0
votes
0answers
10 views

LSTM Multi-state forecast

I follow several tutorials about LSTM multi-step forecast to solve my problem. My problem: I have a time series of price about 3 months (Jan 2018 to Mar 2018) and I assume there are seasonal. So, my ...
1
vote
0answers
11 views

How to develop custom metric with one class priority Keras

I tried like this. I get InvalidArgumentError, but I assume I am doing this completely wrong, I just don't know how to implement in in Tensorflow. ...
2
votes
2answers
19 views

Neural Network Initialization - Every layer?

Does every layer of a Neural Network require weight initialization or just the first? Does the first layer feed into the next layer and initialize itself? My intuition is that every layer needs its ...
0
votes
0answers
15 views

How to train LSTM with previous cell's prediction as an input in Keras?

At the moment I'm using a simple Keras model to learn a sequence of items and after it using the trained model to generate new sequences . I want to change the training to be in the same manner as ...
1
vote
0answers
17 views

How to shift output of predict values into the x (input) column 0 values using Neural network in python

The inputs here are the 3. The output here (LSTM) is the probabilities that the next x1 input ought to be. Means here I have x,x1,x2 input values. 1st three inputs LSTM output1 and then next if x ...
1
vote
0answers
18 views

Tool For Multi-Label Image Classification

I am currently working on a project that requires multi-label image classification. The best way to achieve this seems to be through Binary Relevance. I was intending to use a convolutional neural ...
0
votes
0answers
11 views

Keras: Poor classification by copying model weights before fine tuning

I have a pretrained LSTM model, A. After fine tuning the model (A) on my data for 2 epochs, I get number of incorrect classifications as 46. In the second scenario, before fine tuning the model A on ...
3
votes
2answers
35 views

Keras input shape returning an error

I am currently learning about Keras and have a problem with the input shape of a dense layer.I am currently trying to the mnist dataset.I understand that the input_shape for the train images is (60000,...
2
votes
0answers
17 views

Time Series Forecasting RNN: Masking Values

Suppose you have missing values in a time series E.g. : t1 x1 y1 t2 ? ? t3 x3 y3 t4 ? ? t5 x5 y5 You are trying to forecast this time series using a recurrent ...
1
vote
0answers
26 views
+50

Classify big changes in target variable

I am using a CNN to predict large changes in my target variable X. I am classifying several "set-up" states visually from my images. I am only interested in big changes, or maybe no change. So, I can ...
2
votes
0answers
25 views

How to feed output of predict value back into the input using LSTM in python

The inputs here are the 3. The output here (LSTM) is the probabilities that the next x1 input ought to be. Means here I have x1x2 and x3 input values. 1st three inputs LSTM output1 and then next if x1 ...
1
vote
1answer
18 views

How to use K.function with two inputs and a concatenate layer?

In Keras, I try to compute use the K.function between some layers. But I get an error when I use a Concatenate layer. Here is a ...
1
vote
0answers
18 views

How to get probabilities values with keras?

tensorflow version = '1.12.0' keras version = '2.1.6-tf' I'm using keras with tensorflow backend. I want to get the probabilities values of the prediction. I want the probabilities to sum up to 1. ...
1
vote
1answer
35 views

Keras Applications - using images larger than the default size

I would like to use eg Xception network with default input size 299x299, but my images are 450x600. Are there any other options besides cropping and subsampling ?
1
vote
0answers
18 views

Why is recall so high?

I've built a binary classification model based on Keras and I am getting about 70% accuracy, and about 72% precision and 88% recall, making up to 79% F1-Score. I've tried different data models (...
2
votes
0answers
44 views

Keras' fit_generator() is not calling my generator

When I call Keras' fit_generator(), passing in a custom generator class I created, I see "Epoch 1/1" in the spew and that's all. It hangs right there, and the ...
1
vote
1answer
10 views

Recognizing circled numbers on a piece of paper

I've built a handful of CNN using tensorflow, keras, pytorch for recognizing text/number/objects in an image. What I'm trying to figure out how to do now is how to recognize numbers on a piece of ...
1
vote
0answers
16 views

Multioutput classification in Keras - how to get multivariate probabilities and deal with unseen classes

I'm struggling to design in Keras a deep neural network for multioutput classification model. The network works in tandem with external logic in a kind of feedback loop: in each iteration the external ...
1
vote
0answers
9 views

Keras trained model exported with older version of Keras ( < 2.2.0 )

Is it possible to update a trained model saved in a file without retraining it ? I found the model on the web and I would like to use it but it uses Merge layers ...
1
vote
2answers
37 views

What does the “Loss” value given by Keras mean?

I setup my neural net to use mean square error as shown below. To my understanding (and from reading the documentation) this means that if the correct result of a row is 0.7 and the net predicts 0.8 ...
0
votes
0answers
6 views

Keras multi input model loss plummets, doesn't train

While using keras's multi-input model, the model just doesn't train at all. The accuracy skyrockets to near 100% and the loss plummets, so I think there's something wrong with the data generation. I'...
1
vote
1answer
17 views

Can I use the Softmax function with a binary classification in deep learning?

I want to create a deep learning model (CNN) for binary classification, can I used the softmax function instead of the sigmoid function in binary classification? Adding the classification layer to ...
1
vote
0answers
39 views

Multi-Step Forecast for Multivariate Time Series (LSTM) Keras

I have been trying to understand how to build LSTM model for multivariate time series forecast using Keras but I am still unsure how to present the data in the correct shape. ...
1
vote
0answers
9 views

Keras importing two images of same object for ConvLSTM

I'm trying to use Keras's recurrent models (ConvLSTM2D here) for my neural network. My objective is to takes two images of the same object at different angles, and based on the features from the two ...
0
votes
1answer
17 views

Using keras with sklearn: apply class_weight with cross_val_score

I have a highly imbalanced dataset (± 5% positive instances), for which I am training binary classifiers. I am using nested 5-fold cross-validation with grid search for hyperparameter tuning. I want ...
1
vote
1answer
16 views

Do I classify all types if they are mutually exclusive

I am trying to classify an image that can represents 3 states. Up, down or Middle. If the image does NOT represent Up or Down, then it is by default Middle. Should I train my CNN with a dataset ...
4
votes
3answers
82 views

How to get accuracy, F1, precision and recall, for a keras model?

I want to compute the precision, recall and F1-score for my binary KerasClassifier model, but don't find any solution. Here's my actual code: ...
1
vote
0answers
14 views

Dealing with Error in Neural Network input

When you are building a neural network in which the input values are known to have error is there a way to incorporate this into the network? I.e one value of the input features may have a known small ...
1
vote
1answer
35 views

Production: TensorFlow and Keras

I always here about TensorFlow is good because it is used for deploying and production. Does that mean that people don't use Keras for deploying models? If keras is now integrated into TensorFlow, ...
0
votes
0answers
6 views

ValueError: Error when checking target: expected dense_3 to have shape (None, 1) but got array with shape (7715, 40000)

I'm trying to train a Keras model with Google Cloud's ML Engine. (Keras version is 2.2.4 and TensorFlow version is 1.12.0) This exact code runs fine on my CPU but when I submit the job to cloud, ...
0
votes
1answer
18 views

Running Neural Network experiments in loop

I need to run neural network training with different hyper parameters settings like this: ...
1
vote
0answers
13 views

What should the size of the decoder output be in a sequence to sequence model

In a sequence to sequence model, a lot of the tutorials I have read state that the decoder target length should be the same as the encoder input length (https://blog.keras.io/building-autoencoders-in-...
1
vote
1answer
19 views

Keras decision threshold for Multiple Label prediction

I'm training a Neural Network to predict multiple labels for a given input. My input is a 200 sized vector of integers and the output should be a boolean vector of size 28. My ...
0
votes
1answer
21 views

How to define a multi-dimensional neural network with keras

I have implemented a simple neural network with keras that takes an input of 50 values and returns a classification of '0' or '1'. I believe the model is expecting an input shape of (50, 1). I'd ...
0
votes
0answers
20 views

CNN for Keras Autoencoder

I'm working on my first Autoencoder with Keras. To do so, I followed these two tutorials: Version 1) https://blog.keras.io/building-autoencoders-in-keras.html Version 2) https://ramhiser.com/post/...
1
vote
3answers
176 views

Deep network not able to learn imbalanced data beyond the dominant class

I have data with 5 output classes. The training data has the following no of samples for these 5 classes: [706326, 32211, 2856, 3050, 901] I am using the following keras (tf.keras) code: <...
0
votes
2answers
31 views

how to consider some miss classifications “half correct” using as base categorical_crossentropy - for a trading system

I have a trading system where the model receives 9 time-series and predict : A - strong down B - week down C - neutral D - week up E - strong up (these classes ...
1
vote
0answers
19 views

Keras update N batches

I am creating a specialized network with Keras where the batchsize is an important fixed variable representing the size of inputs that get compared. Due to this that makes the update that happen after ...
0
votes
0answers
12 views

Problems successfuly implementing stacked autoencoder in binary classification problem

Hi im currently working on a binary classification problem, currently i haven't had much success with it however. From the paper A https://journals.plos.org/plosone/article?id=10.1371/journal.pone....
0
votes
0answers
14 views

How to inform class weights when using `tensorflow.python.keras.estimator.model_to_estimator` to convert Keras Models to Estimator API?

I'm having some trouble to convert a pure Keras model to TensorFlow Estimator API on an unbalanced dataset. When using pure Keras API, the class_weight parameter ...