Author:
Haojie Yin
Affiliation:
Department of Applied Mathematics, University of California,Berkeley, Berkeley, United States
Keyword(s):
loss function, LSTM, BiLSTM, stock price prediction, DI-MSE, directional accuracy.
Abstract:
In financial markets, Long Short-Term Memory (LSTM) and Bidirectional Long Short-Term Memory (BiLSTM) models have been proved to achieve high “accuracy” in predicting the next closing price. However, such “accuracy” is commonly referred to price value accuracy-how close the predicted and real prices are. Many prediction models neglect the directional accuracy of predicted prices due to the natural characteristic of Mean Square Error (MSE) as loss function. A predicted price with accurate value can potentially be in the wrong direction which causes significant loss to investors and traders’ wealth. Instead, a useful prediction requires both the correct direction and a value close to real prices. To achieve such a combination and improve directional accuracy, a novel loss function Direction-Integrated Mean Square Error (DI-MSE) is introduced by incorporating directional loss information to conventional MSE. Among 28 stocks including both single stock and stock indices, such as Apple or
SP500, DI-MSE is shown to increase the average directional accuracy to nearly 60%. At the same time, the average value accuracy of predicted price remains around 98%.
(More)