keras

How to plot ROC_AUC curve for each folds in KFold Cross Validation using Keras Neural Network Classifier

Deadly 提交于 2020-12-13 03:12:57
问题 I really need to find ROC plot for each folds in a 5 fold cross-validation using Keras ANN. I have tried the code from the following link [https://scikit-learn.org/stable/auto_examples/model_selection/plot_roc_crossval.html#sphx-glr-auto-examples-model-selection-plot-roc-crossval-py][1] It works perfectly fine when I'm using the svm classifier as shown here. But when I want to use wrapper to use Keras ANN model it shows errors. I am stuck with this for months now. Can anyone please help me

Show examples in tensorflow datasets not working

萝らか妹 提交于 2020-12-12 12:11:43
问题 I want to load the tensorflow flowers dataset and visualize it using tfds.show_examples. import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import tensorflow_hub as hub import tensorflow_datasets as tfds from tensorflow.keras import layers import logging logger = tf.get_logger() logger.setLevel(logging.ERROR) (train_examples, validation_examples), info = tfds.load( 'tf_flowers', with_info=True, as_supervised=True, split=['train[:70%]', 'train[70%:]'], ) fig = tfds.show

Keras CNN for non-image matrix

倾然丶 夕夏残阳落幕 提交于 2020-12-12 10:53:23
问题 I have recently started learning about Deep Learning and Reinforcement Learning, and I am trying to figure out how to code a Convolutional Neural Network using Keras for a matrix of 0s and 1s with 10 rows and 3 columns. The input matrix would look like this for example [ [1, 0, 0], [0, 1, 0], [0, 0, 0], ... ] The output should be another matrix of 0s and 1s, different from the aforementioned input matrix and with a different number of rows and columns. The location of 0s and 1s in the output

sklearn pipeline + keras sequential model - how to get history?

久未见 提交于 2020-12-12 10:38:07
问题 Keras models, when .fit is called, return a history object. Is it possible to retrieve it if I use this model as one step of a sklearn pipeline? btw, i'm using python 3.6 Thanks in advance! 回答1: The History callback records training metrics for each epoch. This includes the loss and the accuracy (for classification problems) as well as the loss and accuracy for the validation dataset, if one is set. The history object is returned from calls to the fit() function used to train the model.

Understanding the values of summary() (Output Shape, Param#)?

混江龙づ霸主 提交于 2020-12-12 09:10:30
问题 I'm checking the output of summary function and don't understand all the printed values. For example, look on this simple code: x = [1, 2, 3, 4, 5] y = [1.2, 1.8, 3.5, 3.7, 5.3] model = Sequential() model.add(Dense(10, input_dim=1, activation='relu')) model.add(Dense(30, input_dim=1, activation='relu')) model.add(Dense(10, input_dim=1, activation='relu')) model.add(Dense(1)) model.summary() The output: Model: "sequential" _________________________________________________________________ Layer

ValueError: No gradients provided for any variable: ['conv2d/kernel:0', 'conv2d/bias:0', 'conv2d_1/kernel:0', 'conv2d_1/bias:0',

荒凉一梦 提交于 2020-12-12 05:38:28
问题 System information Colab tensorflow 2.2.0 Describe the current behavior: I faced this error when i tried to solve my own data issues, which is multiple label semantic segmentations. Below is the code import tensorflow as tf import tensorflow.keras.backend as K IMG_WIDTH = 512 IMG_HEIGHT = 512 IMG_CHANNELS = 3 # batch_shape=(512,512,3) # inputs = Input(batch_shape=(4, 512, 512, 3)) #Build the model inputs = tf.keras.layers.Input((IMG_HEIGHT, IMG_WIDTH, IMG_CHANNELS)) #s = tf.keras.layers

ValueError: No gradients provided for any variable: ['conv2d/kernel:0', 'conv2d/bias:0', 'conv2d_1/kernel:0', 'conv2d_1/bias:0',

馋奶兔 提交于 2020-12-12 05:38:20
问题 System information Colab tensorflow 2.2.0 Describe the current behavior: I faced this error when i tried to solve my own data issues, which is multiple label semantic segmentations. Below is the code import tensorflow as tf import tensorflow.keras.backend as K IMG_WIDTH = 512 IMG_HEIGHT = 512 IMG_CHANNELS = 3 # batch_shape=(512,512,3) # inputs = Input(batch_shape=(4, 512, 512, 3)) #Build the model inputs = tf.keras.layers.Input((IMG_HEIGHT, IMG_WIDTH, IMG_CHANNELS)) #s = tf.keras.layers

Unable to understand the behavior of method `build` in tensorflow keras layers (tf.keras.layers.Layer)

拈花ヽ惹草 提交于 2020-12-12 04:36:18
问题 Layers in tensorflow keras have a method build that is used to defer the weights creation to a time when you have seen what the input is going to be. a layer's build method I have a few questions i have not been able to find the answer of: here it is said that If you assign a Layer instance as attribute of another Layer, the outer layer will start tracking the weights of the inner layer. What does it mean to track the weights of a layer? The same link also mentions that We recommend creating

Keras predict gives different error than evaluate, loss different from metrics

こ雲淡風輕ζ 提交于 2020-12-11 15:53:51
问题 I have the following problem: I have an autoencoder in Keras, and train it for a few epochs. The training overview shows a validation MAE of 0.0422 and an MSE of 0.0024. However, if I then call network.predict and manually calculate the validation errors, I get 0.035 and 0.0024. One would assume that my manual calculation of the MAE is simply incorrect, but the weird thing is that if I use an identity model (simply outputs what you input) and use that to evaluate the predicted values, the

Keras predict gives different error than evaluate, loss different from metrics

谁说胖子不能爱 提交于 2020-12-11 15:52:02
问题 I have the following problem: I have an autoencoder in Keras, and train it for a few epochs. The training overview shows a validation MAE of 0.0422 and an MSE of 0.0024. However, if I then call network.predict and manually calculate the validation errors, I get 0.035 and 0.0024. One would assume that my manual calculation of the MAE is simply incorrect, but the weird thing is that if I use an identity model (simply outputs what you input) and use that to evaluate the predicted values, the