Yinelemeli sinir ağları ile sermaye piyasası yön tahmini üzerine bir çalışma
A study on direction prediction of capital markets with recurrent neural networks
Yazar: MUHİDDİN ÇAĞLAR EREN
Danışman: PROF. DR. ALP ÜSTÜNDAĞ
İstanbul Teknik Üniversitesi / Lisansüstü Eğitim Enstitüsü / Endüstri Mühendisliği Ana Bilim Dalı / Endüstri Mühendisliği Bilim Dalı
Derece: Yüksek Lisans, 2022
Konu: Endüstri ve Endüstri Mühendisliği = Industrial and Industrial Engineering
Dizin: Sermaye piyasası = Capital market ; Yapay sinir ağları = Artificial neural networks ; Zaman serileri = Time series

Özet:
Finansal piyasaları etkileyen faktörler ele alınarak yapılacak finansal piyasa geleceğinin tahminleme süreci, doğru portföy yönetimini sağlayarak kaybı azalıp kazancı arttırabilir. Fakat finansal veriler doğrusal olmayan dinamik ve kaotik karakteristiğe sahip olduğundan finansal piyasalarda karar vermek zorlu bir süreçtir.  Bu probleme çözüm sağlayabilmek amacıyla kullabilecek farklı yöntemler mevcuttur. 
Bunlardan biri olan derin öğrenme, girdi ve çıktı arasındaki ilişkiyi birden fazla sinir ağı katmanında modelleyerek yapabilen makine öğrenimi yöntemleri olarak tanımlanır. Veri biliminin birçok alanında karmaşık veri kümeleri üzerinde yüksek performans gösterdiğinden, son zamanların ilgi çekici yöntemlerinden biri olan derin öğrenmede, geleneksel modellerin aksine, yüksek boyutlu çok değişkenli problemler ve doğrusal olmayan ilişkiler modellenebilir. Bu nedenle derin öğrenme ile sağlanan algoritma başarıları tahminleme çalışmalarında büyük yer tutmaktadır. 
Bu çalışmada, derin öğrenme kavramı altında değerlendirilen yinelemeli sinir ağları mimarilerinden LSTM ve GRU, finansal veri ilişkilerini modellemede kullanılmıştır. Zaman serisi olarak modellenen finansal veri kümeleri Reuters kaynak alınarak oluşturularak derin sinir ağı tahminleme modelleri ile Borsa İstanbul'da işlem gören AKBNK, TCELL ve FROTO hisse senetlerinin fiyat hareketlerinin yön tahmini için karşılaştırmalı yöntemler sunulmuştur.
Çalışmada derin öğrenme yöntemlerinin bir finansal veri kümesi kullanılarak başarılı bir tahmin performansı gösterip gösteremeyeceğinin ortaya konulması amaçlanmıştır. Bununla beraber, çalışma için hazırlanan finansal veri kümeleri üzerinde doğrusal olmayan özellik seçim yöntemleri ile yapılan boyut indirgeme yaklaşımları ve finansal zaman serisi olarak modellenen finansal veri kümelerinin farklı dizileme yaklaşımları ile segmentlere ayrılarak model girdisi olarak kullanılmasının baz model tahmin performansını iyileştirip iyileştirmeyeceğinin karşılıklı analizi yapılmıştır.
Boyut indirgeme sürecinde, finansal veri kümeleri etiketleme yapılarak denetimli öğrenme algoritmalarına elverişli hale getirildikten sonra HSIC Lasso, mRMR, RFE özellik seçim yöntemleri; segmentasyonda da 100, 200, 300 ve 400 adımlı dizileme birer adımlı kayan pencereler yöntemi tasarımda uygulanmıştır. Çalışmanın amacı doğrultusunda LSTM ve GRU mimarileri üzerinde hiper parametre ayarlamaları literatür baz alınarak yapılmıştır. Bununla beraber, tüm tahmin senaryolarında 70 olarak alınmış indirgenmiş özellik sayısına, model stres testlerinden sonra karar verilmiştir.

Abstract:
The forecasting process of the future of the financial market, which is made by considering the factors affecting the financial markets, can reduce the loss and increase the profit by providing the right portfolio management. However, since financial data has non-linear, dynamic and chaotic characteristics, it is a difficult process to make decisions in financial markets. 
Investor decisions can be affected by many macroeconomic factors such as changing economic conditions, political relations, periodic sector based changes, news in the media, expectations and preferences of investors, and non-linear indicators. Decision-making in capital markets, which are not only dependent on economic indicators, but also seriously affected by non-financial factors, has become a very important research area for investors to manage their portfolios correctly. Providing reliable forecasts for capital markets is of great importance for effective market strategies. Therefore, it is necessary to forecast the stock market in order to contribute to the decision-making processes and reduce the investment risk of the investors. There are different methods that can be used to provide a solution to this forecasting problem.
Deep learning, defined as machine learning methods that can model the relationship between input and output in more than one neural network layer, is one of them. Contrary to traditional models, high-dimensional multivariate problems and nonlinear relationships can be modeled in deep learning. Traditional models can be inefficient in dealing with high-dimensional multivariate problems, nonlinear relationships, and incomplete datasets. These data features often occur in real-world data and can be modeled more efficiently using deep neural networks. 
Recurrent neural network is one of the most interesting methods of recent times, since it performs well on complex data sets in many areas of data science. For this reason, algorithm achievements provided by deep learning have a great place in financial forecasting studies. Increasing computers' processing power and facilitating access to data in parallel with the development of hardware and software technologies are some of the important milestones that accelerate the scientific development in this field.
In this study, LSTM and GRU, recurrent neural network architectures evaluated under the concept of deep learning, are used to model financial data relationships. Financial datasets modeled as time series are created based on Reuters, and comparative methods are used for the direction prediction of the price movements of AKBNK, TCELL and FROTO, which are stocks traded in Borsa Istanbul, with deep neural network forecasting models.
Thus, it is aimed to reveal whether deep learning methods can show an acceptable forecasting performance by using financial datasets that include multi dimensional feature space containing many indicators such as company financials, technical indicators, periodic company reports and macroeconomic data. In addition, a comparative analysis has been made whether the use of dimension reduction approaches with nonlinear feature selection methods on the financial datasets prepared for the study and the use of financial datasets modeled as financial time series by segmenting with different sequencing approaches as model input will improve the base recurrent neural network models forecasting performance.
In the age of big data, where large amounts of high-dimensional data are widespread in a wide variety of fields, the rapid growth of data brings with it difficulties for effective and efficient data management. The necessity of applying data mining and machine learning techniques to obtain meaningful information from different types of data is better understood in the age of big data.
As a data preprocessing strategy, feature space size reduction strategies have proven to be effective and efficient, especially in preparing high-dimensional data for a variety of data mining and machine learning problems. Dimension reduction methodology aims to create simpler and more understandable models, improve data mining performance, and prepare clean, understandable data.
When algorithms are applied to high-dimensional data, phenomena known as the curse of dimensionality appear as a critical issue. This concept refers to the phenomenon of sparseness of data in high-dimensional space, which negatively affects algorithms designed for low-dimensional space. Also, with a large number of features, learning models tend to over-learn which can lead to poor performance on unseen data. High-dimensional data can significantly increase memory storage requirements and computational costs for data analytics. In addition, the simplification of the models will increase their applicability and explainability to real life. Models that produce faster results by keeping our model success performance criteria in similar value ranges will provide many benefits in real life. Dimension reduction in the data feature space is one of the most powerful methodology to solve these problems.
In the dimension reduction process applied in the study, HSIC Lasso, mRMR, RFE feature selection methods are used. Feature selection methods were applied to the labeled data before sending time sequences prepared by the sliding windows method to designed LSTM and GRU architecture. The total number of features of the stock datasets prepared in a broad perspective based on Reuters is over 170 and this space is reduced to 70 for all scenarios with the applied methods. The reduced feature number, which is taken as 70 in all forecast scenarios, is decided after the model stress tests.
In time series data segmentation phase, 100, 200, 300 and 400 steps sequencing is done with one day step sliding windows method. Two-dimensional arrays which are used as input to LSTM and GRU are created from the raw data in this time dependent sliding window approach. Models are trained with segmented data using 1240 days on the dataset covering 1270 trading days in total. Afterwards, the classification of 30-day stock directional movements is designed to give a buy and sell signal to investors. In line with the purpose of the study, hyper parameter adjustments on LSTM and GRU architectures are made depending on financial forecasting literature. 
The models' performance outputs obtained in the study are presented for sequencing with 4 different look-back values for AKBNK, TCELL and FROTO stocks, and then performance comparisons are given by considering the look-back values and feature selection methods separately. Performance comparisons were made within the framework of 4 determined metrics. These metrics are long accuracy measuring "BUY" decision, short accuracy measuring "SELL" decision, weighted F1 score measuring overall model performances, and total accuracy metrics measuring total prediction accuracy. 
During the decision-making phase, it is determined that the model could exhibit a balanced performance of more than 50% in long and short accuracy and increase over 55% in total forecast accuracy as an investment acceptance criterion. Performance metrics are evaluated in this respect, and the model that did not meet the investment acceptance criteria in at least one metric is evaluated as unsuccessful and was interpreted as open to improvement in terms of performance.