DOI QR코드

DOI QR Code

A Time Series Graph based Convolutional Neural Network Model for Effective Input Variable Pattern Learning : Application to the Prediction of Stock Market

효과적인 입력변수 패턴 학습을 위한 시계열 그래프 기반 합성곱 신경망 모형: 주식시장 예측에의 응용

  • Lee, Mo-Se (Graduate School of Business IT, Kookmin University) ;
  • Ahn, Hyunchul (Graduate School of Business IT, Kookmin University)
  • 이모세 (국민대학교 비즈니스IT전문대학원) ;
  • 안현철 (국민대학교 비즈니스IT전문대학원)
  • Received : 2018.01.15
  • Accepted : 2018.03.20
  • Published : 2018.03.31

Abstract

Over the past decade, deep learning has been in spotlight among various machine learning algorithms. In particular, CNN(Convolutional Neural Network), which is known as the effective solution for recognizing and classifying images or voices, has been popularly applied to classification and prediction problems. In this study, we investigate the way to apply CNN in business problem solving. Specifically, this study propose to apply CNN to stock market prediction, one of the most challenging tasks in the machine learning research. As mentioned, CNN has strength in interpreting images. Thus, the model proposed in this study adopts CNN as the binary classifier that predicts stock market direction (upward or downward) by using time series graphs as its inputs. That is, our proposal is to build a machine learning algorithm that mimics an experts called 'technical analysts' who examine the graph of past price movement, and predict future financial price movements. Our proposed model named 'CNN-FG(Convolutional Neural Network using Fluctuation Graph)' consists of five steps. In the first step, it divides the dataset into the intervals of 5 days. And then, it creates time series graphs for the divided dataset in step 2. The size of the image in which the graph is drawn is $40(pixels){\times}40(pixels)$, and the graph of each independent variable was drawn using different colors. In step 3, the model converts the images into the matrices. Each image is converted into the combination of three matrices in order to express the value of the color using R(red), G(green), and B(blue) scale. In the next step, it splits the dataset of the graph images into training and validation datasets. We used 80% of the total dataset as the training dataset, and the remaining 20% as the validation dataset. And then, CNN classifiers are trained using the images of training dataset in the final step. Regarding the parameters of CNN-FG, we adopted two convolution filters ($5{\times}5{\times}6$ and $5{\times}5{\times}9$) in the convolution layer. In the pooling layer, $2{\times}2$ max pooling filter was used. The numbers of the nodes in two hidden layers were set to, respectively, 900 and 32, and the number of the nodes in the output layer was set to 2(one is for the prediction of upward trend, and the other one is for downward trend). Activation functions for the convolution layer and the hidden layer were set to ReLU(Rectified Linear Unit), and one for the output layer set to Softmax function. To validate our model - CNN-FG, we applied it to the prediction of KOSPI200 for 2,026 days in eight years (from 2009 to 2016). To match the proportions of the two groups in the independent variable (i.e. tomorrow's stock market movement), we selected 1,950 samples by applying random sampling. Finally, we built the training dataset using 80% of the total dataset (1,560 samples), and the validation dataset using 20% (390 samples). The dependent variables of the experimental dataset included twelve technical indicators popularly been used in the previous studies. They include Stochastic %K, Stochastic %D, Momentum, ROC(rate of change), LW %R(Larry William's %R), A/D oscillator(accumulation/distribution oscillator), OSCP(price oscillator), CCI(commodity channel index), and so on. To confirm the superiority of CNN-FG, we compared its prediction accuracy with the ones of other classification models. Experimental results showed that CNN-FG outperforms LOGIT(logistic regression), ANN(artificial neural network), and SVM(support vector machine) with the statistical significance. These empirical results imply that converting time series business data into graphs and building CNN-based classification models using these graphs can be effective from the perspective of prediction accuracy. Thus, this paper sheds a light on how to apply deep learning techniques to the domain of business problem solving.

지난 10여 년간 딥러닝(Deep Learning)은 다양한 기계학습 알고리즘 중에서 많은 주목을 받아 왔다. 특히 이미지를 인식하고 분류하는데 효과적인 알고리즘으로 알려져 있는 합성곱 신경망(Convolutional Neural Network, CNN)은 여러 분야의 분류 및 예측 문제에 널리 응용되고 있다. 본 연구에서는 기계학습 연구에서 가장 어려운 예측 문제 중 하나인 주식시장 예측에 합성곱 신경망을 적용하고자 한다. 구체적으로 본 연구에서는 그래프를 입력값으로 사용하여 주식시장의 방향(상승 또는 하락)을 예측하는 이진분류기로써 합성곱 신경망을 적용하였다. 이는 그래프를 보고 주가지수가 오를 것인지 내릴 것인지에 대해 경향을 예측하는 이른바 기술적 분석가를 모방하는 기계학습 알고리즘을 개발하는 과제라 할 수 있다. 본 연구는 크게 다음의 네 단계로 수행된다. 첫 번째 단계에서는 데이터 세트를 5일 단위로 나눈다. 두 번째 단계에서는 5일 단위로 나눈 데이터에 대하여 그래프를 만든다. 세 번째 단계에서는 이전 단계에서 생성된 그래프를 사용하여 학습용과 검증용 데이터 세트를 나누고 합성곱 신경망 분류기를 학습시킨다. 네 번째 단계에서는 검증용 데이터 세트를 사용하여 다른 분류 모형들과 성과를 비교한다. 제안한 모델의 유효성을 검증하기 위해 2009년 1월부터 2017년 2월까지의 약 8년간의 KOSPI200 데이터 2,026건의 실험 데이터를 사용하였다. 실험 데이터 세트는 CCI, 모멘텀, ROC 등 한국 주식시장에서 사용하는 대표적인 기술지표 12개로 구성되었다. 결과적으로 실험 데이터 세트에 합성곱 신경망 알고리즘을 적용하였을 때 로지스틱회귀모형, 단일계층신경망, SVM과 비교하여 제안모형인 CNN이 통계적으로 유의한 수준의 예측 정확도를 나타냈다.

Keywords

References

  1. Ahn, H. and K.-j. Kim, "Using genetic algorithms to optimize nearest neighbors for data mining," Annals of Operations Research, Vol.163, No.1(2008), 5-18. https://doi.org/10.1007/s10479-008-0325-2
  2. Chung, Y., S.M. Ahn., J. Yang, and J. Lee, "Comparison of Deep Learning Frameworks: About Theano, Tensorflow, and Cognitive Toolkit," Journal of Intelligence and Information Systems, Vol.23, No.2(2017), 1-17. https://doi.org/10.13088/jiis.2017.23.1.001
  3. Han, H. W., "An Intelligent System Trading using Optimized CBR with Absolute Similarity Threshold," Ph.D. dissertation, The Graduate School of Business IT, Kookmin University, 2017
  4. Hong, T., T. Lee, and J. Li, "Development of Sentiment Analysis Model for the hot topic detection of online stock forums," Journal of Intelligence and Information Systems, Vol.22, No.1(2016), 187-204. https://doi.org/10.13088/jiis.2016.22.1.187
  5. Jeon, S., Y. Chung, and D. Lee, "The Relationship between Internet Search Volumes and Stock Price Changes," Journal of Intelligence and Information Systems, Vol.22, No.2(2016), 81-96. https://doi.org/10.13088/jiis.2016.22.2.081
  6. Kim, S., D. Kim, C. Han, and W. Kim, "Stock Forecasting using Stock Index Relation and Genetic Algorithm," Journal of Korean Institute of Intelligent Systems, Vol 18, No.6(2008), 781-786. https://doi.org/10.5391/JKIIS.2008.18.6.781
  7. Kim, S.-D., "Data Mining Tool for Stock Investors' Decision Support," Journal of The Korea Contents Association, Vol.12, No.2(2012), 472-482. https://doi.org/10.5392/JKCA.2012.12.02.472
  8. Kim, S.-W., and H. Ahn, "Development of an Intelligent Trading System Using Support Vector Machines and Genetic Algorithms," Vol.16, No.1(2010), 71-92.
  9. Kim, Y., E. Shin, and T. Hong, "Comparison of Stock Price Index Prediction Performance Using Neural Networks and Support Vector Machine," The Journal of Internet Electronic Commerce Research, Vol.4, No.3(2004), 221-243. https://doi.org/10.1023/B:ELEC.0000027981.81945.2a
  10. Kwon, D.-C., and B.-Y. Kang, "CPU and GPU Performance Analysis for Convolution Neural Network," The Journal of Korean Institute of Information Technology, Vol.15, No.8(2017), 11-18.
  11. LeCun, Y., L. Bottou, Y. Bengio and P. Haffner, "Gradient-based learning applied to document recognition," Proceedings of the Institute of Electrical and Electronics Engineers, Vol.86, No.11(1998), 2278-2324. https://doi.org/10.1109/5.726791
  12. LeCun, Y., Y. Bengio, and G. Hinton, "Deep learning," Nature, Vol.521, No.7553(2015), 436-444. https://doi.org/10.1038/nature14539
  13. Lee, E. J., C. H. Min, and T. S. Kim, "Development of the KOSPI (Korea Composite Stock Price Index) forecast model using neural network and statistical methods," The Institute of Electronics Engineers of Korea - Computer and Information, Vol.45, No.5(2008), 95-101.
  14. Lee, J.-D., and H. Ahn, "A Study on the Prediction Model of Stock Price Index Trend based on GA-MSVM that Simultaneously Optimizes Feature and Instance Selection," Journal of Intelligence and Information Systems, Vol.23, No.4(2017), 147-168. https://doi.org/10.13088/JIIS.2017.23.4.147
  15. Lee, M.-S., and H. J. Lee, "Stock Price Prediction by Utilizing Category Neutral Terms : Text Mining Approach," Journal of Intelligence and Information Systems, Vol.23, No.2 (2017), 123-138. https://doi.org/10.13088/jiis.2017.23.2.123
  16. Park, J. Y., J. R, and H. J. Shin, "Predicting KOSPI Stock Index using Machine Learning Algorithms with Technical Indicators," Journal of Information Technology and Architecture, Vol.13, No.2(2016), 331-340.
  17. Roh, T. H., T. H. Lee, and I. G. Han, "Forecasting the volatility of KOSPI 200 Using Neural Network-financial Time Series Model," Korean Management Review, Vol.34, No.3 (2005), 683-713.
  18. Ryu, J. P., H. J. Shin, M. H. Kim, and J. Baek, "Pattern Analysis of Stock Prices Using Machine Learning and Data Visualization," Journal of Information Technology and Architecture, Vol.14, No.2(2017), 189-197.
  19. Srivastava, N., G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov, "Dropout: A Simple Way to Prevent Neural Networks from Overfitting," Journal of Machine Learning Research, Vol.15, No.2(2014), 1929-1958.
  20. Torres, J., "First Contact with TensorFlow", Hanbit Media Inc., 2017.

Cited by

  1. 정확히 재가중되는 온라인 전체 에러율 최소화 기반의 객체 추적 vol.25, pp.4, 2018, https://doi.org/10.13088/jiis.2019.25.4.053
  2. 강화학습을 이용한 트레이딩 전략 vol.22, pp.1, 2018, https://doi.org/10.5762/kais.2021.22.1.123