I tried to design an LSTM network using keras but the accuracy is 0.00 while the loss value is 0.05 the code which I wrote is below.
model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(128, activation = tf.nn.relu))
model.add(tf.keras.layers.Dense(128, activation = tf.nn.relu))
model.add(tf.keras.layers.Dense(1, activation = tf.nn.relu))
def percentage_difference(y_true, y_pred):
return K.mean(abs(y_pred/y_true - 1) * 100)
model.compile(optimizer='sgd',
loss='mse',
metrics = ['accuracy', percentage_difference])
model.fit(x_train, y_train.values, epochs = 10)
my input train and test data set have been imported using the pandas' library. The number of features is 5 and the number of target is 1. All endeavors will be appreciated.