0

My LSTM model shows me a bad accuracy i would like to increase it , but I don't know the parameters that I should change. Could someone please explain to me how to fix it. Thanks.

My dataset contains 6871 rows and 16 columns.

model = Sequential()

model.add(LSTM(units=50 ,activation='relu' , return_sequences= True , input_shape=(X_train.shape[1],15 )))
model.add(Dropout(0.2))

model.add(LSTM(units=60 ,activation='relu' , return_sequences= True))
model.add(Dropout(0.3))

model.add(LSTM(units=80 ,activation='relu' , return_sequences= True))
model.add(Dropout(0.3)) 

model.add(LSTM(units=120 ,activation='relu'))
model.add(Dropout(0.3)) 

model.add(Dense(units=1))

Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
lstm (LSTM)                  (None, 120, 50)           13200     
_________________________________________________________________
dropout (Dropout)            (None, 120, 50)           0         
_________________________________________________________________
lstm_1 (LSTM)                (None, 120, 60)           26640     
_________________________________________________________________
dropout_1 (Dropout)          (None, 120, 60)           0         
_________________________________________________________________
lstm_2 (LSTM)                (None, 120, 80)           45120     
_________________________________________________________________
dropout_2 (Dropout)          (None, 120, 80)           0         
_________________________________________________________________
lstm_3 (LSTM)                (None, 120)               96480     
_________________________________________________________________
dropout_3 (Dropout)          (None, 120)               0         
_________________________________________________________________
dense (Dense)                (None, 1)                 121       
=================================================================
Total params: 181,561
Trainable params: 181,561
Non-trainable params: 0

model.compile(optimizer='adam' , loss='mean_squared_error', metrics=['accuracy'])
model.fit(X_train,y_train,epochs=10,batch_size=32)
Epoch 1/10
169/169 [==============================] - 59s 317ms/step - loss: 61886123309.2345 - accuracy: 0.0000e+00
Epoch 2/10
169/169 [==============================] - 56s 332ms/step - loss: 276822.0114 - accuracy: 0.0000e+00
Epoch 3/10
169/169 [==============================] - 56s 329ms/step - loss: 0.0673 - accuracy: 0.0000e+00
Epoch 4/10
169/169 [==============================] - 56s 330ms/step - loss: 0.0643 - accuracy: 0.0000e+00
Epoch 5/10
169/169 [==============================] - 56s 334ms/step - loss: 0.0580 - accuracy: 0.0000e+00
Epoch 6/10
169/169 [==============================] - 57s 335ms/step - loss: 0.0541 - accuracy: 0.0000e+00
Epoch 7/10
169/169 [==============================] - 56s 330ms/step - loss: 0.0551 - accuracy: 6.8456e-05
Epoch 8/10
169/169 [==============================] - 55s 328ms/step - loss: 0.0523 - accuracy: 0.0000e+00
Epoch 9/10
169/169 [==============================] - 55s 326ms/step - loss: 0.0510 - accuracy: 0.0000e+00
Epoch 10/10
169/169 [==============================] - 55s 326ms/step - loss: 0.0526 - accuracy: 2.6656e-05

I just started out look into deep learning, and don't understand what the parameters that increase the accuracy of a LTSM model.

  • Arte you doing classification or regression? Please include your `model.compile()` statement (not here, update your post). If you are doing regression (as it would seem from the activation function of your last layer), [accuracy is meaningless](https://stackoverflow.com/questions/48775305/what-function-defines-accuracy-in-keras-when-the-loss-is-mean-squared-error-mse). – desertnaut Apr 27 '21 at 13:20
  • 1
    @desertnaut I don't remember how many times I see people that are using accuracy in a regression task and complaining about it :/ By the way, he's added his `compile()`, can confirm this is a regression indeed. – Frightera Apr 27 '21 at 13:32
  • This is not a duplicate of the linked question. This is off-topic and belongs on the Datascience or Statistics sites (although it would probably be considered unanswerable there, too). – shadowtalker Apr 27 '21 at 14:12
  • i am doing a regression , i've a numerical data. and the target is a number . – Oussama El khadir Apr 27 '21 at 14:23
  • And the answer to the duplicate question says clearly that accuracy is **meaningless** in regression settings, and that you should not use it for performance assessment. – desertnaut Apr 27 '21 at 14:24
  • 1
    @shadowtalker you do have a point - I changed the target dup. – desertnaut Apr 27 '21 at 14:27

0 Answers0