On retraining intervals and sequence lengths for machine learning models in foreign exchange rate forecasting

Date
2024-03
Journal Title
Journal ISSN
Volume Title
Publisher
Stellenbosch : Stellenbosch University
Abstract
ENGLISH SUMMARY: The foreign exchange market is non-stationary, highly volatile, noisy and non-linear, making it challenging for time series predictions. Market conditions constantly evolve, and finding a robust model that can capture current patterns while adjusting to emerging ones is difficult. Machine learning (ML) models are prone to a phenomenon known as model decay, meaning performance tends to worsen over time as the characteristics of the data set begin to change. Additionally, ML models require sufficient data to learn from, and make accurate predictions. This study investigates the effects of varying how frequently a model is retrained (retraining interval) and the number of lagged data points to use as features (sequence length). The effects are measured on three ML models: a deep neural network capable of processing sequential time series data called long-short term memory (LSTM), an ensemble learning algorithm, random forests (RF), combining multiple decision trees to form a final output and a support vector machine (SVM) model capable of mapping non-linear data into higher dimensions to perform linear regression. Each model’s hyperparameters were optimised by a sequential model-based optimiser, Bayesian optimisation, to best fit the USD/ZAR exchange rate. The results from the calibration indicate that the activation function, ReLu, caused problems with convergence in the LSTM model, and the sigmoid and polynomial kernel functions led to poor results for the SVM model. The RF model was the most consistent and was less sensitive to the hyperparameters used. The retraining intervals tested were yearly, bi-yearly, quarterly and monthly. The sequence lengths tested ranged from one to ten previous days used as features. The LSTM model results showed that the best mean squared error (MSE) comes from the 12-month retraining interval, which outperformed the 6, 3 and 1-month intervals by 0.51%, 3.06% and 5.53%, respectively. Sequence lengths had a smaller impact on the LSTM models, with the best MSE values from sequence lengths above 3. The 9-day sequence length had the lowest MSE of 0.2157, which was a 1.76% improvement over the worst MSE from 1 day. Retraining intervals had a greater effect on the RF models, with the MSE of the 12-month intervals having a 1.54%, 6.35% and 10.71% improvement over the 6, 3, and 1-month intervals. RF models using the 1-day sequence length had a 1.54% lower MSE than the 2nd best sequence length. The sequence lengths of 2–10 days had similar performance with all these MSE values within 0.85% of each other. The SVM had the lowest MSE of all the models at 0.02068, with the sequence length being the more critical hyperparameter to consider. Using a 1-day sequence length saw a 1.19% improvement over the 2nd best sequence length of 2 days and was 2.13% lower than the worst sequence length of 10 days. The MSE values from the different retraining intervals were within 0.14%, indicating minimal effects from this hyperparameter.
AFRIKAANSE OPSOMMING: Die buitelandse valutamark is nie-stasioner, hoogs wisselvallig, met baie geraas en nie-lineer, wat dit uitdagend maak vir vooruitskattings. Marktoestande verander voortdurend, en dit is moeilik om ’n robuuste model te vind wat huidige patrone kan vasvang terwyl dit aanpas by ontwikkelende patrone. Masjienleer (ML) modelle is geneig tot ’n verskynsel bekend as modelverval, wat beteken dat die prestasie oor tyd versleg soos die eienskappe van die datastel begin verander. Daarbenewens vereis ML-modelle voldoende data om van te leer en akkurate voorspellings te maak. Hierdie studie ondersoek die effekte van hoe gereeld ’n model heropgelei word (heropleidingsinterval) en die terugkykvenster (die aantal datapunte terug in die geskiedenis) om as kenmerke te gebruik (reekslengte). Die effek word gemeet op drie ML-modelle: ’n diep neurale netwerk in staat om tydreekse te verwerk, genaamd lang-korttermyngeheue (LSTM), ’n saamgestelde-leer algoritme, willekeurige woude (RF), wat verskeie besluitboomstrukture kombineer om ’n finale afvoer te vorm, en ’n ondersteuningsvektor masjien (SVM) model wat in staat is om nie-linieere data in hoer dimensies te projekteer vir lineere regressie. Elke model se hiperparameters is geoptimeer deur ’n opeenvolgende modelgebaseerde optimeerder, Bayes-optimering, om die beste modelpassing vir die USD/ZAR wisselkoers te verkry. Die resultate van die kalibrasie dui aan dat die aktiveringsfunksie, ReLu, probleme veroorsaak het met konvergensie in die LSTM-model, en die sigmoid- en polinoomkernfunksies gelei het tot swak resultate vir die SVM-model. Die RF-model was die mees konsekwente en was minder sensitief vir die gebruikte hiperparameters. Die heropleidingsintervalle wat getoets is, was jaarliks, twee maal per jaar, kwartaalliks en maandeliks. Die reekslengtes wat getoets is, het gewissel van een tot tien vorige dae wat as kenmerke gebruik is. Die resultate vir die LSTM-model het die beste gemiddelde fout kwadaat (MSE) getoon uit die 12-maande heropleidingsinterval, wat die 6, 3 en 1-maand-intervalle respektiewelik met 0.51%, 3.06% en 5.53% oortref. Reekslengtes het ’n kleiner impak op die LSTM-modelle gehad; die beste MSE-waardes was almal van reekslengtes bo 3. Die 9-daagse reekslengte het die laagste MSE van 0.2157 getoon, wat ’n 1.76% verbetering was oor die slegste MSE van 1 dag. Heropleidingsintervalle het ’n groter effek gehad op die RF-modelle, met die MSE van die 12- maande-intervalle wat ’n 1.54%, 6.35% en 10.71% verbetering getoon het oor die 6, 3, en 1- maand-intervalle. RF-modelle wat die 1-daagse reekslengte gebruik het, ’n 1.54% laer MSE as die 2de beste reekslengte. Die reekslengtes van 2 tot 10 dae het soortgelyke prestasie gehad, met al hierdie MSE-waardes binne 0.85% van mekaar. Die SVM het die laagste MSE van 0.02068 van alle modelle gehad, met die reekslengte as ’n meer kriteke hiperparameter om te oorweeg. Die gebruik van ’n 1-dag-reekslengte het ’n 1.19% verbetering getoon oor die 2de beste reekslengte van 2 dae en was 2.13% laer as die slegste reekslengte van 10 dae. Die MSE-waardes van die verskillende heropleidingsintervalle was binne 0.14%, wat dui op minimale effekte van hierdie hiperparameter.
Description
Thesis (MCom)--Stellenbosch University, 2024.
Keywords
Citation