improve LSTM accuracy

See original GitHub issue

I’m trying to build LSTM architecture to predict sickness rate. I’m actually stuck in 40% accuracy, I’m new in machine learning and I tried several tips like changing the optimzer, the layer node number and the dropout value without any improving. So could you guys help me with some advice.

the x array is composed of 10 columns

the y array is only one column the sickness rate

here is my model def lstm_model(): model = Sequential() model.add(LSTM(10, input_shape=(1,10), return_sequences= True)) model.add(Dropout(0.2)) model.add(LSTM(100, return_sequences= True)) model.add(LSTM(100, return_sequences= False)) model.add(Dropout(0.2)) model.add(Dense(50,kernel_constraint=NonNeg(),kernel_initializer='normal' ,activation="relu")) model.add(Dense(1,activation="linear")) model.compile(optimizer='adam',loss='mean_squared_error',metrics=['accuracy']) return model lstm = lstm_model() this is the output of . evaluate() 1275/1275 [==============================] - 1s 526us/sample - loss: 0.0015 - acc: 0.3930 0.0014869439909029204 0.3930161 and thank you in advance

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dabasajaycommented, Jul 5, 2019

Adding to @RooieRakkert 's answer, there are two methods you can use to check how if your model is performing well for regression task:

  • If you’re using root_mean_squared metric, make sure that training, validation, and testing error are low and close to each other in magnitude.
  • Use R^2 (coefficient of determination) metric from sklearn library. The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get an R^2 score of 0.0. So you can check if your R^2 score is close to 1 then it’s a good model.
2reactions
briannemsickcommented, Jul 2, 2019

In that case linear and mean_square_error are both fine, accuracy is not a valid metric in this case (not a classification problem). Consider using mean_square_error (the loss function) or mean_absolute_error as a metric.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I increase accuracy with Keras using LSTM
Add more lstm layers and increase no of epochs or batch size see the accuracy results. You can add regularizers and/or dropout to...
Read more >
How to increase accuracy of lstm training - Stack Overflow
There're couple of options to increase the accuracy: 1) Increase the hidden layers in the LSTM node. and/or 2) add another layer of...
Read more >
What are some things I can try to increase the accuracy of an ...
You need to properly tune and regularize your model (number of layers, units). · Use a bidrectional LSTM instead of a unidirectional one....
Read more >
Using Accuracy Measure for Improving the Training of LSTM ...
Classification accuracy measure has been used instead of error rate and mean square error methods to train LSTM with above optimizing algorithms.
Read more >
LSTM input output shape , Ways to improve ... - YouTube
In this tutorial we look at how we decide the input shape and output shape for an LSTM. We also tweak various parameters...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found