This is my model- class CNNHyperModel(HyperModel): def __init__(self, input_shape, num_classes): self.input_shape = input_shape self.num_classes = num_classes def build(self, hp): model = keras.Sequential() model.add( Conv1D( filters=hp.Int( "neurons_1", min_value=20, max_value=400, step=20, default=200,), kernel_size=hp.Int("kernal_sizes_1", min_value=1, max_value=10, step=1, default=3,), strides=hp.Int("stride_sizes_1", min_value=1, max_value=10, step=1, default=3,), activation="relu", input_shape=(25,1), padding="same", ) ) model.add( Dropout( rate=hp.Float( "dropout_1", min_value=0.0, max_value=0.5, default=0.25, step=0.05, ) ) ..

#### Category : keras

import random import json import pickle import numpy as np import nltk from nltk.stem import WordNetLemmatizer from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Activation, Dropout from tensorflow.keras.optimizers import SGD lemmatizer = WordNetLemmatizer intents = json.loads(open(‘intents.json’).read()) words = [] classes = [] documents = [] ignore_letters = [‘!’,’?’,’.’,’,’] for intent in intents[‘intents’]: for pattern in ..

My error is ValueError: x and y must have same first dimension, but have shapes (5,) and (1,) Im not sure what I’m doing wrongly. acc = history.history[‘accuracy’] val_acc = history.history[‘val_accuracy’] loss = history.history[‘loss’] val_loss = history.history[‘val_loss’] epochs_range = range(5) plt.figure(figsize = (8, 8)) plt.subplot(2, 1, 1) plt.plot(epochs_range, acc, label = ‘Training Accuracy’) plt.plot(epochs_range, val_acc, ..

I’ve created an emotion detection Model with resnet50 and I’m using the Adam optimizer. However, I get the following error TypeError: set_model() missing 1 required positional argument: ‘model’ And here’s my code to create a model: # Build model on the top of base model model = Sequential() model.add(base_model) model.add(Dropout(0.5)) model.add(Flatten()) model.add(BatchNormalization()) # fully connected ..

I actually trying to implement this paper: https://dl.acm.org/doi/10.1145/3323873.3326592 and it’s required me to input all the words seq in each review by list like: [ [This, restaurant , is, great] ,[This ,hotel, has, a, great, service] , …] btw, all the word is actually word index and the problem is I can’t apply the word ..

I’m trying to run the code in the link below. https://github.com/myeungun/SAR-water-segmentation To run the code, I need 5 prerequisites. CUDA 10.0 Python 3.7.7 Tensorflow 1.14.0 PyTorch 0.4.1 Keras 2.3. I tried to install those packages after creating a new environment in anaconda. However, installing these packages one by one keeps causing inconsistencies. Is there any ..

I am doing Hyper parameter tuning using Keras tuners. I have made a custom objective function- from keras import backend as K def recall_m(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + K.epsilon()) return recall def precision_m(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, ..

I have the following pre-trained keras model: input_1 (InputLayer) [(None, 12, 4)] __________________________________________________________________________________________________ input_2 (InputLayer) [(None, 12, 4)] __________________________________________________________________________________________________ conv1d (Conv1D) (None, 20, 2) input_1[0][0] __________________________________________________________________________________________________ conv1d_3 (Conv1D) (None, 20, 2) input_2[0][0] __________________________________________________________________________________________________ lstm_1 (LSTM) (None, 12, 2) conv1d_3[0][0] __________________________________________________________________________________________________ time_distributed (TimeDistribut (None, 12, 16) lstm_1[0][0] __________________________________________________________________________________________________ time_distributed_1 (TimeDistrib (None, 12, 1) time_distributed[0][0] ================================================================================================== I ..

I have an image dataset with two classes. I want to implement k-fold cross-validation. but don’t know how to. Can anyone please help me.? The dataset is spliced into a train and a test set. and each set has two classes. Source: Python..

I’m trying to write a custom loss function in Keras. I have y_pred and y_true. Both are tensors and the values can be 0 or 1. So, for example, y_true is be: [0,1,0,1] and y_pred is: [1,1,0,0]. I’m trying to compare these two tensors to output the following: [-0.7, 2.5, 0.025, -0.1] The logic is ..

## Recent Comments