1、算法思路
Step 1: Calculate the daily cumulative sentiment score using the extracted news headlines related to crude oil price.
Step 2: Decompose the target variable (i.e., the daily logarithmic returns and 7-day volatility) into different intrinsic modes using VMD.
Step 3: Construct the forecasting input dataset by combining the daily cumulative sentiment score and the decomposed intrinsic modes.
Step 4: Organize the input dataset into a sliding window group with length of 7 days from time t − 6 to time t.
Step 5: Import the input dataset into the BiLSTM neural networks to predict the daily returns and 7-day volatility at time t + 1.
Our BiLSTM prediction model consists of five layers: an input layer, a forward hidden layer, a backward hidden layer, an output layer and a fully-connected layer. The dimensions of the input layers, hidden layers and the output layer are all set to the same dimension as the input dataset. The fully-connected layer consists of one node that corresponds to the dimension of the final prediction value.
注意:这里的全连接层只含一个单元,即只输出一个预测值。因此,收益率和波动率是分开进行预测的。
The input dataset is first imported into the BiLSTM model through the first four layers, then it passes through the fully-connected layer to generate the daily logarithmic returns and 7-day volatility predictions at time t + 1. In this study, the input window length is set to 7 days, which is recommended as the optimal input length for short-term forecasting in previous literature (Zhu et al., 2019). The model utilizes the Adam optimizer with the learning rate set to 0.01. Within the LSTM cells, the tanh function is selected as the activation function.
2、复现BiLSTM