shaping tf.Data as input for LSTM layer fails with incompatible dimensions

I’m trying to build a neural network that predicts the next number from a simple sequence of numbers, thus I’m taking my input of 3 and putting in a tf.data.Dataset, now when I try to feed this to an LSTM layer I get the following error ValueError: Input 0 of layer "lstm" is incompatible with… Read More shaping tf.Data as input for LSTM layer fails with incompatible dimensions

name 'Bidirectional' is not defined

Im following this tutorial and right when I want to initialize a sequential keras, like the code below: model = keras.Sequential() model.add(Bidirectional( CuDNNLSTM(Win_size, return_sequences=True), input_shape=(Win_size, X_train.shape[-1]))) I get an error saying : NameError: name ‘Bidirectional’ is not defined What is the problem ? it is the exact same code as in the tutorial. >Solution :… Read More name 'Bidirectional' is not defined

AttributeError: 'function' object has no attribute 'compile'

I’ve been facing this attribute error. Any ideas how I can solve it please. I can share the whole code def model(input_shape): model = keras.Sequential() model.add(keras.layers.LSTM(64, input_shape=(1,9), return_sequences=True)) model.add(keras.layers.LSTM(64)) model.add(keras.layers.Dense(64, activation=’relu’)) model.add(keras.layers.Dropout(0.3)) model.add(keras.layers.Dense(10, activation=’softmax’)) return model model.compile(loss=’binary_crossentropy’, optimizer=’adam’, metrics=[‘accuracy’]) model.summary() ttributeError Traceback (most recent call last) Input In [67], in <cell line: 1>() —-> 1… Read More AttributeError: 'function' object has no attribute 'compile'

How to find the MSE and MAPE metrics on test data with tensorflow

I have the following LSTM model. How I can check the MSE or MAPE metrics on the test data? import pandas as pd import numpy as np import tensorflow as tf from tensorflow import keras from keras.models import Sequential from keras.layers import LSTM, Dense, Dropout X_train = np.random.randn(100, 5, 1) Y_train = np.random.randn(100, 1) X_test… Read More How to find the MSE and MAPE metrics on test data with tensorflow

Can I create an LSTM where the input data and the target data are asymmetric?

Input data : x.shape = (500, 20, 1) Target data: y.shape = (500, 5, 1) I create the following model: model = Sequential() model.add(LSTM(units = 64, input_shape=(20, 1), return_sequences = True)) model.add(Dense(units=1)) model.compile(loss=’mae’, optimizer=’adam’) model.fit(x, y, epochs=1000, batch_size=1) but I get this error: ValueError: Dimensions must be equal, but are 20 and 5 for ‘{{node… Read More Can I create an LSTM where the input data and the target data are asymmetric?

keras.layers.Concatenate gives 'NoneType' object is not subscriptable

When I try to concatenate my convolutional layers and LSTM layers. It noticed me that " ‘NoneType’ object is not subscriptable". How do I solve it ? I cannot understand why I can’t concatenate them. My code is like: x = inputI x = keras.layers.Reshape((126,40,1))(x) x = keras.layers.Conv2D(32, kernel_size=(3,3), activation=’relu’)(x) x = keras.layers.Conv2D(32, kernel_size=(3,3), activation=’relu’)(x)… Read More keras.layers.Concatenate gives 'NoneType' object is not subscriptable