$$\rightleftharpoonup{xx}$$
$$\longleftharp{xx}$$,
$$\longrightharp{xx}$$,
This study did not involve human participants or vertebrate animal subjects. All data used are publicly available commodity price series from the SMM, which do not require ethical approval. Therefore, no ethical approval was sought or required for this research.
This section delineates the comprehensive and rigorous research design implemented to empirically test the core hypothesis. It provides a detailed exposition of the mathematical formulation and architectural specifics of the thirteen evaluated deep learning models, the precise training protocol, and the formal evaluation metrics. The overarching methodological workflow is visually summarized in Figure 1.

Figure 1: Schematic overview of the research methodology. The diagram illustrates the complete experimental pipeline, including data partitioning, model training exclusively on the Cu price series, evaluation on the Cu test set, and out-of-sample validation on independent Al and Zn series. The dashed feedback loop indicates the structured ablation experiments conducted to analyze the contribution of individual architectural components. Please click here to view a larger version of this figure.
The diagram illustrates the complete experimental pipeline. The process begins with the exclusive use of the Cu price series for model development. This series is partitioned chronologically into training (80%), validation (10%), and test (10%) sets. Thirteen distinct deep learning architectures are then trained and hyperparameter-optimized solely on the Cu training data, with early stopping monitored via the validation set. The primary benchmark is the evaluation of these models on the held-out Cu test set. Crucially, to assess generalizability, the exact same trained models are applied without modification to forecast the entirely independent Al and Zn price series, representing a strict out-of-sample test. Finally, structured ablation experiments (the dashed feedback loop) are conducted to decompose and analyze the performance contribution of individual architectural components (e.g., attention, bidirectional processing, and convolutional layers).
Model Architectures and Mathematical Formulation
We designed and implemented a spectrum of 13 DL models, systematically increasing in architectural complexity from simple recurrent networks to sophisticated multicomponent hybrids. All models share the same core objective: to learn a mapping
from a historical price window Xt = [Pt-L,Pt-L+1,…,Pt-1] of length L = 30 to the subsequent price yt = Pt.
The model families are defined as follows:
Baseline Recurrent Models
GRU: A streamlined recurrent network employing update (zt) and reset (rt) gates to modulate information flow. The hidden state ht is computed as:
(1)
(2)
(3)
(4)
where X is the sigmoid activation,
denotes the Hadamard product, and xt is the input at time t . The final hidden state hL is passed through a linear output layer. Equations 1–4 are adapted from Cho et al.14.
LSTM: Utilizes input (it), forget (ft), and output (ot) gates to maintain a cell state (Ct), providing more explicit control over long-term memory.
Bidirectional Models (BiGRU and BiLSTM)
These models incorporate two separate recurrent layers that process the sequence in forward and reverse directions. The final hidden representation at each time step is the concatenation
, theoretically capturing contextual information from both past and future within the fixed input window.
Attention-Augmented Models (GRU–Attention and LSTM–Attention)
An additive attention mechanism is applied to the sequence of hidden states H = [h1,h2,…,hL] produced by the final recurrent layer. The context vector is defined as a weighted sum:
(5)
(6)
(7)
Here, αi represents the attention weight assigned to the i-th historical time step. The context vector c, encapsulating an adaptive summary of relevant history, is fed to the final prediction layer. Equations 5–7 are adapted from Bello et al.47.
CNN–Hybrid Models (CNN–GRU and CNN–LSTM)
A one-dimensional CNN layer with rectified linear unit (ReLU) activation is prepended to the recurrent layer.
Complex Hybrid Models
These architectures combine multiple components (e.g., CNN–BiGRU–Attention, CNN–BiLSTM–Attention). They represent the state of the art in terms of complexity, aiming to integrate local pattern extraction (CNN), bidirectional contextual modeling, and adaptive temporal weighting (attention) into a single framework.
All models were configured with consistent hidden state dimensions (128 units for recurrent layers and 64 filters for CNN layers) and were finalized with a single linear output layer. This controlled design ensures that performance differences are attributable to architectural choices rather than discrepancies in model capacity tuning. The number of trainable parameters consequently increased substantially along this spectrum.
Training Protocol, Hyperparameters, and Ablation Study Design
Table 1 summarizes the unified and rigorous experimental configuration applied to all thirteen models to ensure a fair comparison and mitigate overfitting. All models were trained from scratch using only the designated Cu training set. The Adam optimizer was used to minimize the mean squared error (MSE) loss. The critical technique of early stopping, monitored on the Cu validation set, was uniformly applied. This ensured that training concluded at the point of optimal generalization on unseen Cu data, thereby preventing models from overfitting to training noise.
| Parameter Category | Specification / Value | Description |
| Core Task & Data |
| Forecasting Target | Next-day price | Standard one-step-ahead prediction. |
| Input Window Length (L) | 60 trading days | Balances sufficient historical context with model complexity and training stability. |
| Model Development |
| Training Set (Cu-only) | First 80% (~2081 observations) | Used for learning model parameters via backpropagation. |
| Validation Set (Cu-only) | Next 10% (~260 observations) | Used for hyperparameter tuning and early stopping; crucial for preventing overfitting. |
| Test Set (Cu-only) | Final 10% (~260 observations) | Final, held-out evaluation of in-sample (Cu) performance. |
| Model Architecture |
| RNN Hidden Units | 128 | Provides adequate representational capacity; kept constant across all RNN-based models. |
| CNN Filters | 64 | Number of feature maps for CNN layers in hybrid models. |
| Training Procedure |
| Optimizer | Adam | Adaptive learning rate optimizer for stable and efficient convergence. |
| Initial Learning Rate | 1 × 10⁻³ | Standard starting rate for Adam. |
| Loss Function | Mean squared error (MSE) | Standard for regression |
| Batch Size | 32 | Efficient mini-batch training. |
| Maximum Epochs | 80 | Upper limit for training iterations. |
| Early Stopping Patience | 10 epochs | Training halts if validation loss does not improve for 20 consecutive epochs; model weights from the best epoch are restored. |
| Evaluation & Validation |
| Primary Metrics | MAE, RMSE, R² | Provide complementary views of error magnitude and variance explained. |
| Generalizability Test | Forecast on full Al and Zn series (2602 observations each) | Models are frozen after Cu training. This is a pure, strict out-of-sample test on entirely different commodities. |
| Ablation Design | GRU → BiGRU → BiGRU–Attention → CNN–BiGRU–Attention | Systematically isolates the impact of adding bidirectionality, attention, and CNN components. |
Table 1: Key experimental parameters and configuration. Summary of the experimental setup applied across all models, including data partitioning, model architecture parameters, training settings, and evaluation metrics.
To deconstruct the contribution of each architectural component, a structured ablation study was designed. Starting from the best-performing baseline (GRU), a progressive “complexity chain” was constructed. Figure 2 visually outlines this complexity chain, illustrating the stepwise addition of components. This stepwise approach allows for the direct attribution of any change in forecasting performance to the incremental addition of bidirectionality, the attention mechanism, and finally the convolutional neural network layer. The performance metrics at each node of this chain provide clear empirical evidence on the value or detriment of each complexity component for the specific task of metal price forecasting.

Figure 2: Complexity chain used in the ablation study. The diagram illustrates the stepwise addition of architectural components, progressing from GRU to BiGRU, BiGRU–Attention, and CNN–BiGRU–Attention. This sequence represents the systematic increase in model complexity used to evaluate the impact of each component on forecasting performance. Please click here to view a larger version of this figure.
Performance Evaluation Metrics
Model performance was rigorously quantified using three standard regression metrics, offering complementary insights into prediction accuracy and explanatory power.
Mean Absolute Error (MAE)
Measures the average magnitude of errors, providing a robust and easily interpretable scale of deviation.
(8)
Root Mean Square Error (RMSE)
Emphasizes larger errors due to the squaring operation, making it more sensitive to outliers and large mistakes.
(9)
Coefficient of Determination (R2)
Represents the proportion of variance in the target variable that is predictable from the model.
(10)
where
is the mean of the true values. An R2 value closer to 1 indicates a model that explains most of the variance in the data. Equations 8–10 are standard regression metrics48. The evaluation was conducted in two distinct, sequential phases to separately assess in-sample benchmark performance and out-of-sample generalizability. (1) Phase 1 (Primary Benchmark): All thirteen models, after training and early stopping on Cu data, were evaluated on the held-out Cu test set. (2) Phase 2 (Generalizability Test): The exact same models, with their parameters frozen, were deployed to generate forecasts for the complete, independent price series of Al and Zn. No retraining or adaptation was performed.
Reproducibility: Detailed Experimental Settings
Daily spot prices (CNY/ton) for Grade A Cu, Al, and Zn were obtained from the SMM public platform (https://www.smm.cn/), spanning January 5, 2015, to September 12, 2025. The raw and processed data are available in a public repository (DOI: 10.5281/zenodo.19976985). The data file contains the columns date, Cu, Al, and Zn. Dates are converted to datetime format and sorted in ascending order. Missing values are handled by forward fill followed by backward fill. Features are standardized using a z-score scaler fitted only on the training set (mean μj, standard deviation σj ,
); the same and are applied to the validation and test sets without refitting. The target variable (Cu, Al, or Zn) is scaled separately using its own respective training set statistics.
Input–output sequences are constructed using a sliding window with input length L = 30 trading days and forecast horizon h = 1 (next-day prediction). For a target index (0 = Cu, 1 = Al, 2 = Zn), each sample is defined as Xi = V[ t - L : t, : ] (shape 30 × 3) and yi = V[ t + h , k] (scalar). No shuffling is applied to preserve temporal order. The dataset is split chronologically without randomness: training comprises indices 0–2080 (2,081 observations, 80%), validation indices 2081–2340 (260 observations, 10%), and test indices 2341–2601 (261 observations, 10%). The corresponding date boundaries are January 5, 2015, to July 31, 2023 (training), August 1, 2023, to October 19, 2023 (validation), and October 20, 2023, to September 12, 2025 (test); the file in the repository provides exact details.
Random seeds are fixed as follows: main experiment seed = 42, and Python, NumPy, and TensorFlow seeds are all set to 42. Weight initialization uses Glorot uniform for input kernels, orthogonal for recurrent kernels, and zeros for biases. The software environment consists of Python 3.10.19, TensorFlow 2.20.0/Keras, NumPy 1.26.4, pandas 2.3.3, scikit-learn 1.7.2, and Matplotlib 3.10.6. Experiments were run on a Windows 11 PC with an Intel Core i7 (2.20 GHz) and 32 GB RAM; no GPU was used.
The Adam optimizer is employed with learning_rate = 1×10-3, β1 = 0.9, β2 = 0.999,
, and weight_decay = 0. The loss function is MSE. A ReduceLROnPlateau scheduler monitors validation loss with factor 0.5, patience 5, and minimum learning rate 1 × 10-5. Early stopping is applied with monitor = val_loss, patience = 10, restore_best_weights = True, and min_delta = 0. Each training epoch consists of a forward pass on the training batch, MSE loss computation, backpropagation, and Adam parameter update. After every epoch, validation loss is computed; early stopping and learning rate reduction are triggered based on this value. The model with the lowest validation loss is restored for testing. Batch size is 32, and samples are fed in chronological order without shuffling (shuffle = False).
For CNN hybrid models, one Conv1D layer with 64 filters, kernel_size = 3, stride = 1, padding = 'same', and rectified linear unit (ReLU) activation is used, followed by MaxPooling1D(pool_size = 2) and Dropout(0.15). In attention-augmented models, the recurrent neural network returns the full hidden sequence H with shape B × T × C. A dense layer with one unit produces a score, and a softmax over time converts these scores into attention weights , with the context vector defined as c = ∑t αt ht. This is followed by a dense layer with 64 units and ReLU activation, Dropout(0.15), and the output dense layer. Bidirectional models concatenate forward and backward hidden states (each 64 units), resulting in 128 dimensions; when attention is used, return_sequences = True preserves the full sequence (B × T × 128).
Evaluation uses direct one-step-ahead prediction (non-recursive). All predictions are inverse-transformed to the original price scale before computing MAE, RMSE, and R2 on that scale. For generalizability tests on Al and Zn, the input scaler fitted on Cu is reused without modification, while each target metal has its own target scaler fitted on its own training targets. In the ablation study, all non-architectural parameters (data, split, scaling, random seed, number of epochs, batch size, optimizer, learning rate, loss function, early stopping, scheduler, dropout) are kept identical across the chain; only the architecture changes. The complete source code and replication instructions are publicly available at Zenodo (10.5281/zenodo.19976985). All figures were generated using Matplotlib 3.10.6 with the provided script; outputs are saved as PDF, SVG, and high-resolution PNG (600 dpi). All models were trained with a maximum of 80 epochs. Early stopping with patience = 10 (monitored on validation loss) was triggered for every model before reaching the epoch limit. For instance, the GRU model stopped at epoch 37 (best epoch 27, best validation loss 0.0040), while the most complex hybrid CNN–BiLSTM–Attention stopped at epoch 23 (best epoch 13, best validation loss 0.0072). The complete list of stopped epochs, best epochs, and best validation losses for all 13 models is available in the Zenodo repository, ensuring full transparency and reproducibility without overloading the main text with a table. The theoretical discussions (Lipschitz bounds, sample complexity, Rademacher complexity, bias–variance decomposition, attention entropy, and mutual information) are conceptual explanations for the empirical results and do not alter the training objective or model implementation. Finally, to assess stability, the main experiments were repeated with five random seeds (1, 7, 21, 42, and 2024); the mean and standard deviation of RMSE across these runs are reported in the Results section, where the GRU maintained competitive mean RMSE with low variance, supporting stable performance across random initializations.