## 4 Stock Price Prediction Model Methodology and Research Design
### Model Architecture
The first sub-block consists of two consecutive convolution layers with 64 filters; stride = 1 \(\times\) 1; with padding; and with kernel size = 1 \(\times\) 1 for the first layer and 3 \(\times\) 1 for the second one. This selection is based on a nuanced understanding of the financial data, where the smaller kernel size (1 \(\times\) 1) allows for focused, localised feature extraction, capturing fine-grained details critical for discerning subtle patterns in stock price movements. The larger kernel size (3 \(\times\) 1) in the second layer broadens the scope to capture more extensive contextual information. The second sub-block consists of two subsequent convolution layers with 64 filters; stride = 1 \(\times\) 1; with padding; and kernel size = 1 \(\times\) 1 for the first layer and 5 \(\times\) 1 for the second one. This choice is grounded in the need for the model to adapt to diverse scales of features present in financial data. The smaller kernel size (1 \(\times\) 1) again prioritises localised details, whereas the larger kernel size (5 \(\times\) 1) extends the receptive field to incorporate global context, allowing the model to grasp larger-scale patterns in stock price movements. The third sub-block consists of a subsequent max-pooling layer with kernel size = 3 \(\times\) 1; stride = 1 \(\times\) 1; and with padding, and a convolution layer with 64 filters; stride = 1 \(\times\) 1; with padding; and with kernel size = 1 \(\times\) 1. The inclusion of the max-pooling layer serves to downsample the data, reducing dimensionality while retaining essential features. The subsequent convolution layer with a smaller kernel size (1 \(\times\) 1) focuses on further refining the extracted features. The rationale behind these choices lies in optimising the network's ability to discern patterns at different scales, facilitating hierarchical feature learning tailored to the unique characteristics of financial data. The parametric rectified linear unit (PReLU) activation function is also applied for all the convolution layers in the second block as was done for the first block. The overarching architectural decisions, including the specific kernel sizes, number of filters, and strides, are informed by a data-driven approach and empirical studies, ensuring that the model is adept at extracting meaningful features for precise and accurate stock price predictions. The resulting 3D tensor is reshaped to 2D to match the input shape of the consequent Gated Recurrent Unit (GRU) layer with 64 units. The decision to incorporate a GRU layer is rooted in the need for the model to effectively capture temporal dependencies and hierarchical representations in the sequential financial data. This is particularly crucial in the context of stock price movements, where the historical sequence of prices holds valuable insights into potential future trends. The GRU's gating mechanism allows it to selectively update and memorise information, mitigating the vanishing gradient problem and facilitating the learning of long-term dependencies. The GRU layer, in turn, is connected to the final dense layer with three neurons, each of them corresponding to one of three output classes (\"upward\", \"flat\", \"downward\"). For this final layer, the softmax activation function [40] is used to distribute the outcome probability among these three classes. The output from this function \(f(x)_{i}\) for the i-th element (\(x\)) of input vector x, consisting of K elements, is defined according to the formula \(f(x)_{i}=\frac{e^{x_{i}}}{\sum_{j=1}^{k}e^{x_{j}}}\), where K is the number of classes (three in this case). The configuration of the TFF-CL-GRU model, including the determination of the number of layers, units, filters, kernel sizes, strides, padding, and other characteristics, was systematically chosen to optimise its overall performance. This process involved iteratively fine-tuning these architectural parameters to enhance the model's capacity to learn intricate patterns and relationships from the training data.