Stock Market Prediction Based on Generative Adversarial Network
Department of Computer Science and Technology, Ocean University of China, Qingdao, 266100, China
最近看的一篇關於生成對抗網絡在股票市場預測中的運用的文獻,是由中國海洋大學的kangzhang等人於2018年發表在IIKI上,主要方法是以多層感知機(MLP)為鑒別器,長短期記憶網絡(LSTM)為生成器來預測收盤價。其中生成器用LSTM構建,用於從股票市場的給定數據中挖掘股票的數據分布,並在相同的分布中生成數據;鑒別器由MLP設計,包含7210010個神經元的3個隱層單元,用以區分真實的股票數據和生成的數據。數據集為標准普爾S&P500指數的日數據和多個交易日的多支股票,特征為:(開盤價,最高價,最低價,收盤價,成交量,換手率以及五日均值),從而對收盤價進行預測,對比以LSTM,ANN,SVR等baseline,它取得了相對較好的結果。
1.Abstract:
Deep learning has recently achieved great success in many areas due to its strong capacity in data process. For instance, it has been widely used in financial areas such as stock market prediction, portfolio optimization, financial information processing and trade execution strategies. Stock market prediction is one of the most popular and valuable area in finance. In this paper, we propose a novel architecture of Generative Adversarial Network (GAN) with the Multi-Layer Perceptron (MLP) as the discriminator and the Long Short-Term Memory (LSTM) as the generator for forecasting the closing price of stocks. The generator is built by LSTM to mine the data distributions of stocks from given data in stock market and generate data in the same distributions, whereas the discriminator designed by MLP aims to discriminate the real stock data and generated data. We choose the daily data on S&P 500 Index and several stocks in a wide range of trading days and try to predict the daily closing price. Experimental results show that our novel GAN can get a promising performance in the closing price prediction on the real data compared with other models in machine learning and deep learning.
文章主要方法介紹:
1.A novel Generative Adversarial Network (GAN) architecture with Long-Short Term Memory (LSTM) network as the generator and Multi-Layer Perceptron (MLP) as the discriminator is proposed. The model trained in an end-to-end way to predict the daily closing price by giving the stock data in several past days.
2.We try to generate the same distributions of the stock daily data through the adversarial learning system, instead of only utilizing traditional regression methods for the price forecasting.
2.The generator:
The generator of our model is designed by LSTM with its strong ability in processing time series data. We choose the daily data in the last 20 years with 7 financial factors to predict the future closing price. The 7 factors of the stock data in one day are High Price, Low Price, Open Price, Close Price, Volume, Turnover Rate and Ma5 (the average of closing price in past 5 days). The 7 factors are valuable and significant in price prediction with the theory of technical analysis, Mean Reversion, or MAR. Therefore, these factors can be used as 7 features of the stock data for the price prediction. Suppose our input is X = {x1, ..., xt}, which consists of the daily stock data of t days. Each xk in X is a vector, which is composed of 7 features as follows:
1.Abstract:
Deep learning has recently achieved great success in many areas due to its strong capacity in data process. For instance, it has been widely used in financial areas such as stock market prediction, portfolio optimization, financial information processing and trade execution strategies. Stock market prediction is one of the most popular and valuable area in finance. In this paper, we propose a novel architecture of Generative Adversarial Network (GAN) with the Multi-Layer Perceptron (MLP) as the discriminator and the Long Short-Term Memory (LSTM) as the generator for forecasting the closing price of stocks. The generator is built by LSTM to mine the data distributions of stocks from given data in stock market and generate data in the same distributions, whereas the discriminator designed by MLP aims to discriminate the real stock data and generated data. We choose the daily data on S&P 500 Index and several stocks in a wide range of trading days and try to predict the daily closing price. Experimental results show that our novel GAN can get a promising performance in the closing price prediction on the real data compared with other models in machine learning and deep learning
文章主要方法介紹:
1.A novel Generative Adversarial Network (GAN) architecture with Long-Short Term Memory (LSTM) network as the generator and Multi-Layer Perceptron (MLP) as the discriminator is proposed. The model trained in an end-to-end way to predict the daily closing price by giving the stock data in several past days.
2.We try to generate the same distributions of the stock daily data through the adversarial learning system, instead of only utilizing traditional regression methods for the price forecasting.
2.The generator:
The generator of our model is designed by LSTM with its strong ability in processing time series data. We choose the daily data in the last 20 years with 7 financial factors to predict the future closing price. The 7 factors of the stock data in one day are High Price, Low Price, Open Price, Close Price, Volume, Turnover Rate and Ma5 (the average of closing price in past 5 days). The 7 factors are valuable and significant in price prediction with the theory of technical analysis, Mean Reversion, or MAR. Therefore, these factors can be used as 7 features of the stock data for the price prediction. Suppose our input is X = {x1, ..., xt}, which consists of the daily stock data of t days. Each xk in X is a vector, which is composed of 7 features as follows:
輸入為X={x1,,,xt},表示t天的股票數據,每個x是一個包含7個股票屬性特征的7維向量。提取LSTM輸出的ht,將其放入一個包含7個神經元的全連接層,來生成x^t+1的股票數據(生成器生成的,不是真實的),x^t+1的目標是接近xt+1(真實數據),從而從生成的數據中得到t+1天的預測收盤價。
The output of generator G(X) is defifined as follows:
g(·):LSTM的輸出。
ht:股票數據X = {x1, ..., xt}經過LSTM模型作用后的輸出。
δ:激活函數(ReLU修正線性單元)。
Wh:全連接層的權重。
Bh:全連接層的偏置。
Target:通過歷史數據X和生成數據x^t+1來預測x^t+2的數據。
3.The Discriminator:
The purpose of the discriminator is to constitute a differentiable function D(可微函數D) to classify the input data. The discriminator is expected to output 0 when inputting a fake data and output 1 when inputting a real data.(如果是真實數據,鑒別器輸出1,如果是偽造數據,則鑒別器輸出0) Here, we choose an MLP as our discriminator with three hidden layers h1,h2,h3 including 72,100,10 neurons, respectively. The Leaky ReLU is used as the activation function among the hidden layers and the sigmoid function is used in the output layer.
In addition, the cross entropy loss is chosen as the loss function to optimize the MLP. In particular, we concatenate the X = {x1, ..., xt} and xˆt+1 to get {x1, ..., xt, xˆt+1} as the fake data Xfake. Similarly, we concatenate the X = {x1, ..., xt} and xt+1 to get {x1, ..., xt, xt+1} as the real data Xreal. The output of the discriminator is defined as follows:
d(·) :多層感知機的輸出和sigmoid激活函數。
Xfake和Xreal為標量。
方法:某一天前的歷史數據和這天的生成器生成的數據用來生成偽造數據Xfake,某一天前的歷史數據和這天的真實數據用來生成真實數據Xreal。
4.The Architecture of GAN:
生成器生成股票數據Xfake和Xreal,鑒別器通過隱層單元輸出判別結果。
方法:定義兩個損失:Gloss和Dloss來得到最優化函數值,我們將經典的GAN的生成器損失和Mean Square Error(MSE均方誤差)組合起來,組成鑒別器的損失Gloss。
5.experiment results
評測標准:
1.Mean Absolute Error(MAE),平均絕對誤差
2.Root Mean Square Error (RMSE),均方根誤差
3.Mean Absolute Percentage Error (MAPE) ,平均絕對百分比誤差
4.Average Return (AR),平均收益率
第k天的真實收盤價為yk,預測收盤價為yk^,評測指標計算方法如下:
評測對比:本實驗通過Root Mean Square Error (RMSE),均方根誤差,Mean Absolute Error(MAE),平均絕對誤差和Average Return (AR),平均收益率等指標。對比了3種經典的股票預測方法Support Vector Regression (SVR), ANN and LSTM作為baseline。Low MAE, RMSE and MAPE indicate that the prediction of closing price is approximate to the real data. AR shows the daily average return of these stocks based on four prediction methods.
預測結果對比:
6.閱讀總結
這篇文章使用了目前比較熱門的生成對抗網絡用在股票價格預測,是一個新方法上的突破。實驗結果只和三個很簡單的模型的baseline進行對比,雖然各項指標都比較高,但是並沒有和目前做的比較好的模型進行對比。
改進:
1.增加股票因子以提高准確率。
2.結合自然語言處理。
參考文獻:
[1]Kang Zhang, Guoqiang Zhong, Junyu Dong, Shengke Wang, Yong Wang:Stock Market Prediction Based on Generative Adversarial Network. IIKI 2018: 400-406
[2]Teema Leangarun, Poj Tangamchit, Suttipong Thajchayapong:Stock Price Manipulation Detection using Generative Adversarial Networks. SSCI 2018: 2104-2111