keras

plot Roc curve using keras

旧街凉风 提交于 2021-02-10 20:46:23
问题 I have a neural network model and I am using KerasClassifier and then using KFold for cross-validation. Now I am having issues in plotting the ROC curve. I have tried few codes but most of them is giving me an error of multi-labeled is not interpreted. I have the following code till my neural network produces the accuracy. I will be thankful if anyone can help me with the later part of the code. import numpy as np import pandas as pd from keras.layers import Dense, Input from keras.models

Getting error message while calculating rmse in a time series analysis

时间秒杀一切 提交于 2021-02-10 19:35:20
问题 I am trying to replicate this example of time series analysis in R using Keras (see Here) and unfortunately I am receiving error message while computing first average rmes coln <- colnames(compare_train)[4:ncol(compare_train)] cols <- map(coln, quo(sym(.))) rsme_train <- map_dbl(cols, function(col) rmse( compare_train, truth = value, estimate = !!col, na.rm = TRUE )) %>% mean() rsme_train Error message: Error in is_symbol(x) : object '.' not found There are some helpful comments at the bottom

Getting error message while calculating rmse in a time series analysis

五迷三道 提交于 2021-02-10 19:32:36
问题 I am trying to replicate this example of time series analysis in R using Keras (see Here) and unfortunately I am receiving error message while computing first average rmes coln <- colnames(compare_train)[4:ncol(compare_train)] cols <- map(coln, quo(sym(.))) rsme_train <- map_dbl(cols, function(col) rmse( compare_train, truth = value, estimate = !!col, na.rm = TRUE )) %>% mean() rsme_train Error message: Error in is_symbol(x) : object '.' not found There are some helpful comments at the bottom

Using prediction from keras model as a layer inside another keras model

半世苍凉 提交于 2021-02-10 18:25:05
问题 Suppose we have a model already trained for some task can we use that models prediction as a lambda layer inside another model? I am thinking something in the following format: pretrained_model=get_Model() #Loaded from a different file pretrained_model.load_weights('pretrained_model_weights.h5') base_model = VGG16(weights = 'imagenet',include_top=False,input_shape (240,320,3)) for layer in base_model.layers: layer.trainable = True img_input=base_model.input encoded=base_model.output

Output dimension of Keras model

岁酱吖の 提交于 2021-02-10 18:07:14
问题 I use ImageDataGenerator to load my training data train_generator = train_datagen.flow_from_directory( directory= TRAIN_PATH, target_size=(224, 224), color_mode="rgb", batch_size=32, class_mode="categorical", shuffle=True, seed=42 ) After that I get a message Found 6552 images belonging to 102 classes. When I define the model the way model1 = MobileNetV2(include_top=False, input_shape=(224, 224, 3)) flat1 = Flatten()(model1.outputs) class1 = Dense(1024, activation='relu')(flat1) output =

Using a custom R generator function with fit_generator (Keras, R)

北战南征 提交于 2021-02-10 17:48:13
问题 I'd like to train a convolutional network to solve a multi-class, multi-label problem on image data. Due to the nature of the data, and for reasons I'll spare you, it would be best if I could use a custom R generator function to feed to the fit_generator command, instead of its built-in image_data_generator and flow_images_from_directory commands (which I was successfully able to get working, just not for this particular problem). Here (https://www.rdocumentation.org/packages/keras/versions/2

Using a custom R generator function with fit_generator (Keras, R)

[亡魂溺海] 提交于 2021-02-10 17:47:30
问题 I'd like to train a convolutional network to solve a multi-class, multi-label problem on image data. Due to the nature of the data, and for reasons I'll spare you, it would be best if I could use a custom R generator function to feed to the fit_generator command, instead of its built-in image_data_generator and flow_images_from_directory commands (which I was successfully able to get working, just not for this particular problem). Here (https://www.rdocumentation.org/packages/keras/versions/2

Keras' fit_generator() for binary classification predictions always 50%

落花浮王杯 提交于 2021-02-10 17:30:00
问题 I have set up a model to train on classifying whether an image is a certain video game or not. I pre-scaled my images into 250x250 pixels and have them separated into two folders (the two binary classes) labelled 0 and 1 . The amount of both classes are within ~100 of each other and I have around 3500 images in total. Here are photos of the training process, the model set up and some predictions: https://imgur.com/a/CN1b6LV train_datagen = ImageDataGenerator( rescale=1. / 255, shear_range=0,

Keras' fit_generator() for binary classification predictions always 50%

梦想的初衷 提交于 2021-02-10 17:29:29
问题 I have set up a model to train on classifying whether an image is a certain video game or not. I pre-scaled my images into 250x250 pixels and have them separated into two folders (the two binary classes) labelled 0 and 1 . The amount of both classes are within ~100 of each other and I have around 3500 images in total. Here are photos of the training process, the model set up and some predictions: https://imgur.com/a/CN1b6LV train_datagen = ImageDataGenerator( rescale=1. / 255, shear_range=0,

Tensorflow keras timeseries prediction with X and y having different shapes

不羁的心 提交于 2021-02-10 15:44:10
问题 I am trying to do time series prediction with tensorflow and keras with X and y having different dimensions: X.shape = (5000, 12) y.shape = (5000, 3, 12) When I do the following n_input = 7 generator = TimeseriesGenerator(X, y, length=n_input, batch_size=1) for i in range(5): x_, y_ = generator[i] print(x_.shape) print(y_.shape) I get as desired the output (1, 7, 12) (1, 3, 12) (1, 7, 12) (1, 3, 12) ... This is because my data is meteorological, I have 5000 days, for training in the array X I