I'm working on building an LSTM model to binary classify price movements.
My training data is data I simulated, it's a 2,000 rows * 3,780 columns dataframe of price movements. I have a separate labels file that classifies price movements as either 1 or 2 (due to memory).
From what I've read, it appears as though two loss functions are the most appropriate for binary classification:
- Binary Cross-Entropy
- Hinge Loss
I've implemented two separate LSTM models in google colab which run as expected.
I have the same code for both models, with just the loss function being changed from a Squared Hinge loss in the former to a Binary Cross Entropy in the latter.
My issue is deciding which is the better model, as the model outputs give conflicting outputs.
Hinge Loss Output:
Training Output:
- The loss starts at 0.3, then goes to 0.20 after and stays pretty much constant for the remaining 98 epochs.
- The MSE does decrease marginally across the epochs from 2.8 to 1.68 at the end. Average MSE = 1.72.
- The accuracy is 0.00 on every epoch (which I don't understand).
Validation Output:
- The Validation loss starts at 0.0117 and goes to 9.8264e-06 by the end.
- The Validation MSE starts at 2.4 and ends at 1.54. Average Validation MSE = 1.31.
- The Validation accuracy is 0.00 on every epoch (which again I don't understand).
Binary Cross Entropy Loss Output:
Training Output:
- The loss starts at 8.3095, then goes to 3.83 after and stays pretty much constant for the remaining 97 epochs.
- The MSE does decrease marginally across the epochs from 2.8 to 1.68 at the end. Average MSE = 1.69.
- The accuracy starts at 0.00 and increased to roughly 0.8 by end.
Validation Output:
- The Validation loss starts at -0.82 and goes to -.89 by the end.
- The Validation MSE starts at 1.56 and ends at 1.53. Average Validation MSE = 1.30.
- The Validation accuracy starts at 0.00 and increased to roughly 0.997 by end.
So, I have a question now:
Why is the accuracy of the SHL model 0.00? Is there an error in my model?
My code is saved here: https://nbviewer.jupyter.org/github/Ianfm94/Financial_Analysis/blob/master/LSTM_Workings/LSTM_Model.ipynb
The training data* and labels data are saved at the below location: https://github.com/Ianfm94/Financial_Analysis/tree/master/LSTM_Workings
*Training data here is split into two separate files due to Github limiting file size to 25 mb's.
Any help would be greatly appreciated.
Thanks.