I am trying to fit LSTM model, but it gave me an error with the shape. my dataset has 218 rows and 16 features including the targeted one. I split the data, %80 for training and %20 for testing, after compiling the model and run it, i got this error: Variable definitions: batch_size = 160 epochs = 20 timesteps =
Tag: keras
trying to callibrate keras model
I’m trying to calibrate my CNN model by Sklearn implementation CalibratedClassifierCV, tried to wrap it as KerasClassifier and to override the predict function but without success. someone could say me what I did wrong? this is the model code: this is me trying to calibrate it : the output : valX_cnn and val_y_cnn are of type np.array. tried even to
Extract data from tensorflow dataset (e.g. to numpy)
I’m loading images via I want to use the obtained data in non-tensorflow routines too. Therefore, I want to extract the data e.g. to numpy arrays. How can I achieve this? I can’t use tfds Answer I would suggest unbatching your dataset and using tf.data.Dataset.map: Or as suggested in the comments, you could also try just working with the batches
Why is my model giving poor accuracy when the data is loaded using tf.data?
I am new to the tf.data API and trying to use it to load images from disk in the Dogs vs. Cats Redux: Kernels Edition Kaggle competition. To do this, I first created a pandas DataFrame named train_df with two columns – file_path containing the relative path of images and target containing the target labels 0 (for cat) and 1(for
How to include future values in a time series prediction of a RNN in Keras
I currently have a RNN model for time series predictions. It uses 3 input features “value”, “temperature” and “hour of the day” of the last 96 time steps to predict the next 96 time steps of the feature “value”. Here you can see a schema of it: and here you have the current code: Here you have some test data
Cannot run Carlini and Wagner Attack using foolbox on a tensorflow Model
I am using the latest version of foolbox (3.3.1), and my code simply load a RESNET-50 CNN, adds some layers for a transferred learning application, and loads the weights as follows. Now I would like to attack it using the foolbox 3.3.1 Carlini and Wagner attack, here is the way I load the model for foolbox My dataset is split
Why should the input_shape property of a Conv2D layer be specified only for the first Conv2D layer?
I am new to AI/ML stuff. I’m learning TensorFlow. In some tutorial, I noticed that the input_shape argument of a Conv2D layer was specified only for the first. Code looked kinda like this: In many examples, not only in the above, the instructor didn’t include that argument in there. Is there any reason for that? Answer The next layers derive
Python Tensorflow Shape Mismatch (WaveNet)
I was trying to run a WaveNet, which is specified in https://github.com/mjpyeon/wavenet-classifier/blob/master/WaveNetClassifier.py. Part of my code is as follows: Here, self.input_shape=X_train.shape and self.output_shape=(11,) It successfully printed out the model’s summary, but was outputting the following error: However, my X_train has a shape of (19296, 110250). I was trying to figure out on why the X_train has been reshaped from (19296,
Python Keras ValueError: Data cardinality is ambiguous
I am attempting to make a model that can predict whether a credit card transaction was fraudulent or not. My dataset is available on Kaggle. Everything works up to when I fit my model, when I get this error: Could someone help me figure out what’s wrong? Answer The main issue with your code is that the model’s input shape
How to correctly pass a split function to TextVectorization layer
I’m defining a custom split callable for TextVectorization like this: resulting in: as seen above the split function is working correctly outside of the TextVectorization layer but failes when passed as a callable Answer Your split_slash function does not seem to properly tokenize the phrases. It is probably because your TextVectorization layer strips your phrases of all punctuation including /