Next Article in Journal
Global Dynamics of Population–Toxin Systems with Nonlocal Usage of Memory Under Periodic Boundary Conditions
Previous Article in Journal
Curvature Invariants on Partially Totally Real Submanifolds in Complex Space Forms
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Residual Exogenous–Autoregressive Gated Forecasting Framework for Nonlinear Dynamic Time Series: Application to Hydrogen Sulfide Prediction

by
Maha Mesfer Alghamdi
Department of Computer Science and Engineering, College of Applied Studies, King Saud University, Riyadh 11451, Saudi Arabia
Mathematics 2026, 14(16), 2878; https://doi.org/10.3390/math14162878
Submission received: 3 July 2026 / Revised: 20 July 2026 / Accepted: 20 July 2026 / Published: 9 August 2026
(This article belongs to the Section E1: Mathematics and Computer Science)

Abstract

Multi-horizon forecasting of nonlinear dynamic time series with exogenous inputs is challenging when the target variable exhibits strong temporal persistence and the exogenous variables provide horizon-dependent corrective information. Direct forecasting models must learn both the carry-forward behavior of the target and the nonlinear deviations caused by changes in the process inputs. This study proposes a residual exogenous–autoregressive gated forecasting framework for nonlinear dynamic prediction. The proposed model decomposes the forecasting operator into a persistence component and a learnable residual correction term. Historical target dynamics and exogenous input dynamics are encoded using two dedicated CNN-LSTM branches, and their latent representations are combined through a sample-dependent sigmoid gating mechanism. The final prediction is obtained by adding the learned correction to the most recent target observation. The framework is evaluated on a benchmark sulfur recovery unit dataset for multi-horizon hydrogen sulfide H2S concentration forecasting using a leakage-aware nested blocked hyperparameter selection and evaluation protocol. Three forecasting horizons are considered: one-step, five-step, and ten-step ahead prediction. The proposed method achieved the lowest RMSE at the one-step and five-step horizons and remained highly competitive at the ten-step horizon, where its RMSE was nearly identical to the best PatchTST baseline. Across the three horizons, the proposed model obtained RMSE values of 0.0096 ± 0.0020 , 0.0436 ± 0.0097 , and 0.0521 ± 0.0138 , corresponding to RMSE reductions over the persistence baseline of 39.7%, 10.0%, and 13.7%, respectively. The model also maintained a compact parameter count and sub-millisecond inference latency, supporting its feasibility for online soft-sensing applications. Regression, time-series, error distribution, Taylor diagram, and SHAP analyses show that the residual gated formulation is particularly effective for short- and medium-horizon forecasting, while longer-horizon prediction remains more difficult because of increasing temporal uncertainty. The SHAP results indicate that historical H2S dominates short-horizon prediction, whereas airflow-related variables become more influential at the longer horizon. The results demonstrate that the proposed framework provides an interpretable and computationally compact learning approach for residual forecasting in persistent nonlinear dynamic systems.

1. Introduction

Multi-horizon forecasting of nonlinear dynamic time series is an important problem in applied mathematics, machine learning, and industrial process modeling. In many practical systems, the future value of a target variable depends not only on its own historical trajectory but also on exogenous variables that describe the surrounding operating conditions. This structure is common in industrial soft sensor applications, where difficult-to-measure quality or safety variables are estimated from routinely measured process variables [1,2,3]. However, accurate forecasting remains challenging when the target signal exhibits strong temporal persistence, nonlinear input–output relationships, non-stationary operating behavior, and measurement noise. Under such conditions, a naive persistence predictor may already provide a strong baseline, and an effective forecasting model must therefore learn meaningful residual corrections beyond simple carry-forward prediction.
Soft sensors have become a widely used data-driven tool for real-time process monitoring, quality prediction, and decision support in industrial systems. They are particularly useful when direct analyzers are expensive, delayed, unavailable, or difficult to maintain under harsh operating conditions [1,2,3]. Recent studies also emphasize that practical soft sensors should not only provide accurate predictions but should also be stable, interpretable, and validated using protocols that respect the ordered nature of industrial time-series data [3,4]. These requirements motivate the development of compact forecasting formulations that explicitly account for temporal dependence, exogenous process effects, and leakage-aware model evaluation.
Hydrogen sulfide (H2S) concentration forecasting in sulfur recovery units (SRUs) provides a representative case study for this type of nonlinear dynamic forecasting problem. H2S is a hazardous sulfur-containing compound associated with toxicity, corrosion, environmental pollution, and operational safety risks [5,6]. In addition, H2S conversion and selective oxidation have been widely studied because of their importance in sulfur processing, emission control, and value-added chemical production [7]. In SRU operation, H2S and SO2 concentrations are closely related to reaction stoichiometry, furnace air demand, sulfur recovery efficiency, and tail- gas quality. Therefore, reliable estimation and forecasting of sulfur gas concentrations are important for safe operation, environmental compliance, and efficient process control [8,9,10,11]. In addition to SRU applications, data-driven H2S prediction has also been studied in urban drainage networks and industrial emission-source identification, further showing the broader relevance of reliable H2S monitoring [12,13].
Early SRU modeling studies relied mainly on first-principles, thermodynamic, and kinetic descriptions of the Claus process and related sulfur recovery reactions. Such models are physically meaningful and have been used for process simulation, optimization, sensitivity analysis, and energy efficiency improvement [8,9,10,11,14]. Machine learning-assisted optimization has also been explored for SRU performance improvement under Industry 4.0-oriented settings [15]. Nevertheless, purely mechanistic models usually require detailed process knowledge, accurate reaction parameters, and well-defined boundary conditions. Their deployment can become difficult when the plant operates under changing feed composition, catalyst aging, load variation, sensor noise, and unobserved disturbances. These limitations have encouraged the use of data-driven soft sensors for SRU monitoring and sulfur gas concentration estimation.
Traditional data-driven soft sensor methods include multivariate regression, principal component analysis, partial least squares, support vector regression, artificial neural networks, Gaussian process regression, relevance vector machines, and ensemble learning approaches [1,2,16]. In the SRU context, nonlinear soft sensors, relevance vector machine-based models, multi-state-dependent parameter models, and warning-oriented soft-sensing systems have been investigated for H2S and SO2 estimation [16,17,18]. These methods are valuable because they can learn empirical input–output relationships from historical data. However, many conventional models rely on static or flattened temporal representations and may have limited ability to represent nonlinear sequence dynamics, local temporal fluctuations, and horizon-dependent behavior in ordered industrial data.
Deep learning has therefore become an important direction for nonlinear dynamic soft sensor modeling [19]. Recurrent neural networks and long short-term memory (LSTM) networks are well suited to sequential data because they can represent temporal dependencies across historical process trajectories [20,21]. LSTM-based soft sensors have been applied to industrial quality prediction, wastewater treatment monitoring, batch-process modeling, and gas concentration forecasting [22,23,24,25]. Hybrid CNN-LSTM models further combine convolutional extraction of local temporal patterns with recurrent modeling of longer dependencies and have shown promise for nonlinear industrial processes and gas-related forecasting tasks [26,27]. In SRU modeling, hybrid LSTM-fuzzy systems have also been explored to capture dynamic behavior while improving interpretability [28]. Despite these advances, many deep sequence models process all variables through a single stream and directly predict the future target value, without explicitly separating autoregressive target persistence from exogenous input-driven correction.
More recent SRU sulfur gas forecasting studies have introduced multiscale decomposition, attention mechanisms, and transformer-based time-series models. For example, hybrid frameworks combining variational mode decomposition (VMD), complete ensemble empirical mode decomposition with adaptive noise (CEEMDAN), PatchTST, sparse probabilistic attention, and hyperparameter optimization have been proposed for H2S and SO2 forecasting [29]. These approaches are related to broader developments in signal decomposition, attention-based modeling, and transformer time-series forecasting [30,31,32,33]. Other SRU studies have investigated stacked isomorphic autoencoders, semi-supervised VMD-ESN soft sensing, and transfer-incremental stacked autoencoder modeling [34,35,36]. Although these methods can improve forecasting performance, they often involve decomposition pipelines, transformer backbones, or multi-stage optimization strategies. This creates a need for compact and interpretable forecasting formulations that can exploit persistence while still learning exogenous corrections in a structured manner.
Based on the above discussion, several methodological gaps can be identified. First, many SRU soft sensor and sulfur gas forecasting models do not explicitly formulate the prediction task as a residual correction around a persistence reference, even though H2S concentration exhibits strong temporal persistence. Second, many sequence models rely on single-stream temporal encoders, which can obscure the distinction between autoregressive target history information and exogenous process-input information. Third, adaptive fusion between autoregressive and exogenous information sources remains limited in compact CNN-LSTM-based soft sensor models. Fourth, many forecasting studies emphasize predictive accuracy without jointly analyzing computational feasibility, inference latency, and model size, which are important for online soft-sensing deployment. Fifth, the horizon-dependent physical interpretation of airflow variables in H2S forecasting remains insufficiently explored, particularly in relation to how the importance of historical target information and exogenous operating variables changes from short- to longer-horizon prediction.
To address these gaps, this study proposes a residual exogenous–autoregressive gated forecasting framework for nonlinear dynamic time-series prediction, with application to multi-horizon H2S concentration forecasting in an SRU process. The proposed framework decomposes the forecasting operator into a persistence component and a learnable residual correction term. Historical H2S dynamics and exogenous airflow dynamics are encoded through two dedicated CNN-LSTM branches, and their latent representations are combined using a sample-dependent sigmoid gate. The final prediction is obtained by adding the learned correction to the most recent H2S observation. This formulation provides a structured alternative to direct single-stream prediction by allowing the model to represent persistence and exogenous correction through separate but adaptively fused latent spaces.
The main contributions of this study are summarized as follows:
  • A residual exogenous–autoregressive forecasting formulation is proposed for persistent nonlinear dynamic time series, where the future target value is modeled as a persistence reference plus a learnable nonlinear correction.
  • A dual-branch CNN-LSTM architecture is developed to separately encode historical H2S dynamics and exogenous airflow dynamics, allowing autoregressive and process-input information to be represented in distinct latent spaces.
  • A sample-dependent sigmoid gating mechanism is introduced to adaptively fuse autoregressive and exogenous latent representations before residual prediction.
  • A leakage-aware nested blocked evaluation protocol is used to compare the proposed framework with persistence, tree-based ARX models, recurrent models, convolutional recurrent models, and compact Transformer-family baselines.
  • A comprehensive evaluation is conducted using predictive metrics, computational complexity, inference latency, Taylor diagrams, and horizon-wise SHAP analysis to assess forecasting accuracy, deployment feasibility, and physical interpretability.
The remainder of this paper is organized as follows. Section 2 presents the mathematical formulation, dataset description, preprocessing procedure, proposed residual gated forecasting framework, baseline models, hyperparameter selection protocol, and evaluation metrics. Section 3 reports and discusses the numerical performance comparison, forecasting horizon analysis, persistence improvement, computational complexity, regression and time-series analyses, error distribution, Taylor diagram, and SHAP-based interpretation. Section 4 concludes the paper and outlines future research directions.

2. Mathematical Formulation and Methodology

This section presents the mathematical formulation and implementation of the proposed residual exogenous–autoregressive gated forecasting framework. The forecasting problem is first defined as a multi-horizon nonlinear dynamic regression task with exogenous inputs and autoregressive target history. A residual operator decomposition is then introduced to separate the persistence component from the learnable correction component. After that, the proposed dual-branch gated CNN-LSTM realization is described in detail, including the exogenous encoder, autoregressive encoder, adaptive latent fusion, residual prediction head, and optimization objective. The benchmark SRU H2S dataset, preprocessing procedure, baseline models, blocked hyperparameter optimization protocol, and evaluation metrics are then described to ensure a fair and reproducible numerical comparison.
Figure 1 summarizes the overall methodological workflow adopted in this study. The process begins with the industrial SRU dataset, which contains airflow-related process variables and H2S concentration measurements. The data are first preprocessed and transformed into supervised time-windowed sequences suitable for multi-horizon forecasting. Exploratory data analysis is then performed to examine the statistical properties, distributions, and correlations of the process variables. After that, the proposed residual exogenous–autoregressive gated forecasting framework and baseline models are trained and optimized using a nested blocked evaluation protocol. Finally, the trained models are assessed using multiple prediction metrics, graphical analyses, and SHAP-based interpretation to evaluate both forecasting accuracy and model explainability.

2.1. Dataset Description and Analysis

This study uses a benchmark industrial sulfur recovery unit (SRU) dataset for hydrogen sulfide (H2S) concentration prediction. The dataset is publicly available through Mendeley Data [37] and contains 10,081 ordered samples. Six variables were extracted from the dataset: five airflow-related process variables and one output target. The input variables are monoethanolamine (MEA) airflow, sour water stripper (SWS) airflow, airflow in the MEA zone, airflow in the SWS zone, and secondary airflow. The output target is the normalized H2S concentration.
The original dataset variables were mapped to physically meaningful process names before analysis and modeling. Specifically, x 1 x 5 correspond to the five airflow-related input variables, while y 1 corresponds to the H2S concentration. Only these six variables were used in the present study. No missing values were observed in the selected variables, and the original chronological order of the samples was preserved throughout the forecasting experiments.
For each sample i, the input vector is expressed as
x i = x 1 , i , x 2 , i , x 3 , i , x 4 , i , x 5 , i ,
where x 1 is the MEA airflow, x 2 is the SWS airflow, x 3 is the airflow in the MEA zone, x 4 is the airflow in the SWS zone, and  x 5 is the secondary airflow. The corresponding output is the H2S concentration, denoted as y i . Therefore, the static soft sensor mapping can be written as
y ^ i = f ( x i ) , f : R 5 R .
All variables are normalized within the range [0, 1]. Table 1 summarizes the descriptive statistics of the dataset.
As shown in Table 1, the airflow variables exhibit different levels of variability. Airflow in the SWS zone has the highest standard deviation among the input variables, whereas airflow in the MEA zone has the lowest. The H2S concentration has a low mean value of 0.0807 and a median value of 0.0734, indicating that most observations correspond to low normalized concentration levels, while high-concentration observations occur less frequently.
The marginal distributions of the selected SRU variables are shown in Figure 2. The airflow-related variables exhibit nonuniform and partly multimodal distributions, indicating that the process measurements are concentrated around several operating regions rather than uniformly covering the normalized range. MEA airflow and SWS airflow occupy broad value ranges with several dominant concentration regions, whereas airflow in the SWS zone and secondary airflow are more concentrated in higher normalized regions. In contrast, the H2S concentration is strongly right-skewed and concentrated near low normalized values, with relatively few high-concentration observations. This distributional pattern reflects the operating characteristics of the industrial process and highlights the imbalance of the target response.
The violin plots in Figure 3 provide a complementary view of the same variables by showing their density structure, median, interquartile spread, and mean values. The airflow variables display different density profiles, confirming that each measured stream contains distinct statistical information about the SRU operating condition. The narrow density of the H2S concentration near the lower normalized range confirms the skewed target distribution and the presence of sparse upper-tail observations. These characteristics motivate the use of robust loss functions and multiple evaluation metrics, because a single average error measure may not fully describe forecasting behavior under skewed target distributions.
Pearson correlation analysis was further performed to examine the linear dependence among the five input variables. The resulting correlation matrix is shown in Figure 4. MEA airflow and SWS airflow show a strong positive correlation of 0.91, indicating coupled variation between the two acid-gas-related streams. Airflow in the SWS zone and secondary airflow also show a strong positive correlation of 0.88. In contrast, airflow in the MEA zone has weak or negative correlations with several other variables.
Overall, the exploratory analysis shows that the SRU dataset is characterized by nonuniform input distributions, a skewed H2S target distribution, and noticeable correlations among several process variables. These characteristics suggest that H2S concentration prediction is affected by coupled and nonlinear process behavior, motivating the use of dynamic nonlinear soft sensor models.

2.2. Multi-Horizon Exogenous–Autoregressive Forecasting Problem

Let { ( x t , y t ) } t = 1 T denote an ordered nonlinear dynamic dataset, where x t R m is the vector of exogenous process variables at time index t, y t R is the scalar target variable, m is the number of exogenous variables, and T is the total number of observations. In the SRU case study considered in this work, m = 5 , corresponding to MEA airflow, SWS airflow, airflow in the MEA zone, airflow in the SWS zone, and secondary airflow, while y t denotes the normalized H2S concentration. The dataset is treated as an ordered sequence; therefore, the forecasting formulation must preserve temporal causality and must not use any information after the prediction origin t.
For a historical window length L, the exogenous input sequence available at time t is defined as
X t L + 1 : t = x t L + 1 , x t L + 2 , , x t R L × m .
Each row of X t L + 1 : t corresponds to one time index, and each column corresponds to one exogenous process variable. This matrix therefore describes the recent evolution of the measured operating conditions.
The autoregressive target history sequence is defined as
Y t L + 1 : t = y t L + 1 , y t L + 2 , , y t R L × 1 .
This sequence contains the historical trajectory of the target variable up to the current time index t. The complete information available for prediction is then represented by
S t = X t L + 1 : t , Y t L + 1 : t R L × ( m + 1 ) .
For a forecasting horizon h, the objective is to estimate the future target value y t + h using only X t L + 1 : t and Y t L + 1 : t . The general nonlinear forecasting operator is written as
y ^ t + h = F θ ( h ) X t L + 1 : t , Y t L + 1 : t ,
where F θ ( h ) ( · ) is a horizon-specific trainable forecasting operator parameterized by θ . In this study, three forecasting horizons are considered:
h { 1 , 5 , 10 } ,
corresponding to one-step, five-step, and ten-step ahead predictions.
For each horizon h, the supervised learning set is constructed as
D h = X t L + 1 : t , Y t L + 1 : t , y t + h t = L T h .
This construction ensures that the input window ends at time t, while the target is located at time t + h . Therefore, no future information is included in the model input. The resulting task is a nonlinear dynamic regression problem with two distinct information sources: the exogenous process sequence X t L + 1 : t and the autoregressive target history sequence Y t L + 1 : t . The proposed framework is designed to encode these two sources separately, fuse them adaptively, and predict the future target through a residual correction relative to the latest available target observation.

2.3. Residual Exogenous–Autoregressive Decomposition

For temporally persistent dynamic signals, the most recent observation y t often provides a strong reference for short-horizon forecasting. A direct forecasting model that predicts y t + h from scratch must learn both the carry-forward component of the target and the nonlinear deviation caused by changes in the process variables. This can be inefficient when the target trajectory changes slowly over short intervals, because a large part of the future value is already explained by the latest available observation.
The persistence operator is defined as
P ( y t ) = y t .
The horizon-dependent residual correction is then written as
r t , h = y t + h y t .
Therefore, the future value can be decomposed exactly as
y t + h = y t + r t , h .
Instead of directly approximating y t + h , the proposed framework learns a nonlinear approximation of the residual term:
Δ y ^ t + h = R θ ( h ) X t L + 1 : t , Y t L + 1 : t ,
where R θ ( h ) ( · ) is a horizon-specific residual operator. The complete forecasting operator is therefore expressed as
F θ ( h ) = P + R θ ( h ) .
Accordingly, the predicted future target value is computed as
y ^ t + h = y t + R θ ( h ) X t L + 1 : t , Y t L + 1 : t .
The advantage of this formulation depends on the statistical structure of the target trajectory. If the target is persistent over horizon h, the residual r t , h usually has smaller dispersion than the future target itself. This can be expressed as
Var y t + h y t < Var y t + h ,
which indicates that the residual learning problem is more concentrated than the direct prediction problem. Under this condition, the model focuses on the nonlinear correction around the persistence reference rather than relearning the dominant carry-forward behavior. In the SRU H2S forecasting problem, this is appropriate because the target concentration exhibits strong short-term continuity, while the exogenous airflow variables mainly provide corrective information when the process state changes.
The residual formulation also provides a direct mathematical connection with the naive persistence baseline. If the learned residual correction is zero for all inputs, then
R θ ( h ) X t L + 1 : t , Y t L + 1 : t = 0 y ^ t + h = y t .
Thus, the proposed model contains persistence as a special case and improves over it only when the learned correction term captures meaningful deviations from the latest target observation. This makes the persistence baseline a natural reference for evaluating whether the residual operator contributes additional predictive information.

2.4. Data Preprocessing and Sequence Construction

The SRU dataset is provided in normalized form, where all variables are scaled within the range [ 0 , 1 ] . Nevertheless, standardization was applied within each training fold to improve numerical stability during model optimization. To avoid information leakage, the mean and standard deviation were computed only from the training portion of each fold and then applied to the corresponding validation and test portions. For a generic variable v t , the standardized value is computed as
v ˜ t = v t μ train σ train + ϵ ,
where μ train and σ train are the training fold mean and standard deviation, respectively, and  ϵ is a small positive constant used for numerical stability.
The same preprocessing rule was applied to the input variables and the target variable during model training. After prediction, the estimated H2S values were transformed back to the original normalized scale before computing the evaluation metrics. This procedure ensures that the reported errors are evaluated on the same scale as the benchmark dataset while preventing information from validation or test blocks from influencing the training normalization statistics.
The ordered time series was converted into supervised samples using the sliding-window construction defined in Equations (3)–(8). For the classical autoregressive with exogenous input (ARX) baseline models, the two historical sequences were flattened into a single feature vector:
q t = vec X t L + 1 : t , Y t L + 1 : t R L ( m + 1 ) ,
where vec ( · ) denotes vectorization. For the SRU case study, m = 5 , and therefore q t R 6 L . This representation allows the tree-based and boosting-based ARX models to use the same historical information as the sequence models, but without preserving the two-dimensional temporal structure.
For the LSTM, CNN-LSTM, and proposed residual gated forecasting framework, the input was kept as a sequence. The proposed framework further separates S t into two components: the exogenous sequence X t L + 1 : t and the autoregressive target sequence Y t L + 1 : t . This separation is important because the two sources have different roles: Y t L + 1 : t describes target persistence, while X t L + 1 : t describes operating-condition changes that may explain deviations from persistence.

2.5. Proposed Residual Gated Forecasting Framework

The residual operator R θ ( h ) ( · ) is implemented using a compact dual-branch CNN-LSTM architecture with adaptive gated latent fusion. The overall architecture is shown in Figure 5. The framework consists of five main components: an exogenous temporal encoder, an autoregressive temporal encoder, a sample-dependent gating module, a gated latent fusion module, and a residual prediction head. The exogenous encoder processes X t L + 1 : t , whereas the autoregressive encoder processes Y t L + 1 : t . The two latent representations are then adaptively fused, and the residual prediction head estimates Δ y ^ t + h , which is added to the latest available target value y t .
The CNN-LSTM encoder used in each branch is illustrated in Figure 6. The convolutional layer extracts local temporal patterns from the input sequence, the nonlinear activation introduces feature nonlinearity, dropout provides regularization, and the LSTM layer summarizes the temporal evolution into a compact latent representation. The two branches have the same functional form but do not share parameters, because the exogenous input sequence and the autoregressive target sequence represent different physical and statistical information sources.
Let
U x = X t L + 1 : t R L × m
denote the exogenous branch input and let
U y = Y t L + 1 : t R L × 1
denote the autoregressive branch input. For a generic branch b { x , y } , let U b R L × m b be the branch input, where m x = m and m y = 1 .
A one-dimensional convolution is first applied along the temporal dimension. Let κ b denote the kernel size, q b denote the number of convolution filters, and  U ¯ b denote the padded input sequence used to preserve temporal length. For filter c { 1 , , q b } and time position { 1 , , L } , the convolution output is
a , c ( b ) = β c ( b ) + r = 0 κ b 1 j = 1 m b w r , j , c ( b ) U ¯ + r , j ( b ) ,
where w r , j , c ( b ) is the convolution coefficient associated with temporal offset r, input channel j, and filter c, and  β c ( b ) is the bias term. The convolution therefore learns local temporal patterns within each branch input.
The activated and regularized convolutional representation is computed as
C , c ( b ) = D p ψ a , c ( b ) ,
where ψ ( · ) is the ReLU activation function and D p ( · ) denotes dropout with probability p during training. The resulting sequence is
C ( b ) = C 1 ( b ) , C 2 ( b ) , , C L ( b ) R L × q b .
The convolutional sequence C ( b ) is then passed to an LSTM layer. For each time step , the LSTM update equations are
i ( b ) = σ W i ( b ) C ( b ) + U i ( b ) h 1 ( b ) + b i ( b ) ,
f ( b ) = σ W f ( b ) C ( b ) + U f ( b ) h 1 ( b ) + b f ( b ) ,
o ( b ) = σ W o ( b ) C ( b ) + U o ( b ) h 1 ( b ) + b o ( b ) ,
s ˜ ( b ) = tanh W s ( b ) C ( b ) + U s ( b ) h 1 ( b ) + b s ( b ) ,
s ( b ) = f ( b ) s 1 ( b ) + i ( b ) s ˜ ( b ) ,
h ( b ) = o ( b ) tanh s ( b ) ,
where i ( b ) , f ( b ) , and  o ( b ) are the input, forget, and output gates, respectively; s ˜ ( b ) is the candidate cell state; s ( b ) is the memory cell state; h ( b ) is the hidden state; σ ( · ) is the sigmoid function; and ⊙ denotes element-wise multiplication.
The final hidden state is used as the branch-level latent representation:
z b = h L ( b ) R d , b { x , y } ,
where d is the LSTM hidden dimension. Hence, the two encoders can be written compactly as
z x = E x X t L + 1 : t , z y = E y Y t L + 1 : t ,
where E x ( · ) and E y ( · ) denote the exogenous and autoregressive CNN-LSTM encoders, respectively.
After obtaining the two latent representations, a sample-dependent gate is computed from their concatenation:
g t = σ W g z y ; z x + b g ,
where [ z y ; z x ] R 2 d , W g R d × 2 d , b g R d , and  g t [ 0 , 1 ] d . The gate is computed separately for each input sample and controls the dimension-wise contribution of the autoregressive and exogenous latent representations.
The fused latent representation is obtained as
z f , t = g t z y + 1 g t z x ,
where 1 R d is a vector of ones. This operation performs element-wise latent interpolation. When a component of g t approaches one, the corresponding fused dimension relies mainly on the autoregressive representation. When it approaches zero, the corresponding fused dimension relies mainly on the exogenous representation. Therefore, the fusion mechanism allows the model to adaptively balance persistence-driven information and exogenous correction information.
The residual correction is then estimated by a nonlinear regression head:
Δ y ^ t + h = ϕ z f , t ,
where ϕ ( · ) denotes a fully connected residual mapping. For a one-hidden-layer realization, this mapping can be written as
Δ y ^ t + h = v r ψ W r z f , t + b r + c r ,
where W r , b r , v r , and  c r are trainable parameters.
The final prediction is obtained by adding the estimated residual correction to the most recent target observation:
y ^ t + h = y t + Δ y ^ t + h .
Combining the above equations, the proposed residual exogenous–autoregressive gated forecasting operator can be written as
y ^ t + h = y t + ϕ g t E y Y t L + 1 : t + 1 g t E x X t L + 1 : t ,
with
g t = σ W g E y Y t L + 1 : t ; E x X t L + 1 : t + b g .
Equations (37) and (38) summarize the proposed forecasting framework. The model differs from conventional single-stream sequence predictors in three main aspects. First, it separates exogenous and autoregressive temporal encoding. Second, it adaptively fuses the two latent representations using a sample-dependent gate. Third, it predicts a residual correction relative to the persistence reference y t rather than predicting the future value directly.
The adaptive gate in Equation (38) can be interpreted as a bounded latent mixing coefficient between autoregressive persistence information and exogenous correction information. Since each element of g t is produced by a sigmoid activation, it satisfies
0 g t , j 1 , j = 1 , , d .
Therefore, each dimension of the fused representation is a convex interpolation between the corresponding autoregressive and exogenous latent components:
z f , t , j = g t , j z y , j + ( 1 g t , j ) z x , j .
This bounded interpolation prevents unbounded amplification during the fusion step and gives the model a controlled mechanism for adjusting the relative contribution of the two information sources. When g t , j is close to one, the fused representation relies mainly on the autoregressive target history branch, which is appropriate when the target trajectory is locally persistent. When g t , j is close to zero, the fused representation relies more strongly on the exogenous branch, which allows airflow-related process changes to influence the residual correction. Thus, the gate does not impose a fixed global weighting between the two branches; instead, it provides a sample-dependent and feature-dependent fusion rule that changes with the local dynamic state of the process. Table 2 summarizes the main components of the proposed model.

2.6. Optimization Objective and Training Procedure

For each forecasting horizon h, the model parameters are learned by minimizing the empirical Huber loss over the corresponding training set. For a measured target y t + h and a predicted target y ^ t + h , the prediction error is defined as
e t , h = y t + h y ^ t + h .
The Huber loss is defined as [38]
L δ y t + h , y ^ t + h = 1 2 e t , h 2 , | e t , h | δ , δ | e t , h | 1 2 δ 2 , | e t , h | > δ ,
where δ is the Huber threshold. This loss behaves quadratically for small errors and linearly for larger errors. It is therefore less sensitive to rare large deviations than mean squared error while still preserving smooth optimization behavior around small prediction errors. This property is suitable for the considered H2S forecasting problem because the target distribution is skewed and contains rare high-concentration observations.
The empirical risk minimization problem for horizon h is written as
θ h = arg min θ 1 | D h train | X t L + 1 : t , Y t L + 1 : t , y t + h D h train L δ y t + h , y ^ t + h ,
where D h train denotes the training subset for the corresponding horizon.
Algorithm 1 summarizes the training and prediction procedure of the proposed framework. The algorithm first constructs the exogenous and autoregressive branch inputs, extracts their latent representations using separate CNN-LSTM encoders, computes the adaptive gate, forms the fused latent representation, estimates the residual correction, and finally obtains the prediction by residual addition.
Algorithm 1: Training and prediction procedure of the proposed residual gated forecasting framework
Require: Exogenous sequence X t L + 1 : t , autoregressive target sequence Y t L + 1 : t , latest target value y t , target value y t + h
Ensure: Predicted target value y ^ t + h
1:
Encode exogenous dynamics: z x E x ( X t L + 1 : t )
2:
Encode autoregressive dynamics: z y E y ( Y t L + 1 : t )
3:
Compute adaptive gate: g t σ ( W g [ z y ; z x ] + b g )
4:
Fuse latent representations: z f , t g t z y + ( 1 g t ) z x
5:
Estimate residual correction: Δ y ^ t + h ϕ ( z f , t )
6:
Compute final prediction: y ^ t + h y t + Δ y ^ t + h
7:
Compute Huber loss: L δ ( y t + h , y ^ t + h )
8:
Update trainable parameters θ using gradient-based optimization

2.7. Baseline Models

To evaluate the effectiveness of the proposed residual exogenous–autoregressive gated forecasting framework, the model was compared with a set of representative forecasting baselines. The benchmark set was selected to cover different levels of modeling complexity: a persistence reference model, classical nonlinear autoregressive models with exogenous inputs, recurrent and convolutional recurrent sequence models, and compact Transformer-family time-series models. This comparison allows the proposed framework to be evaluated against simple carry-forward prediction, nonlinear flattened history regression, recurrent temporal modeling, local convolutional–recurrent sequence modeling, and attention-based sequence representation.
The first baseline is the naive persistence predictor. For a forecasting horizon h, this model assumes that the future target value is equal to the most recent observed target value:
y ^ t + h = y t .
This baseline is particularly important in the present problem because the target variable exhibits strong temporal persistence. In relation to the residual decomposition in Equation (13), the persistence model corresponds to the special case in which the residual operator is identically zero:
R θ ( h ) X t L + 1 : t , Y t L + 1 : t = 0 .
Therefore, any useful residual forecasting model should improve over this reference by learning a nonzero correction term that captures deviations from persistence.
The second group of baselines consists of classical nonlinear autoregressive models with exogenous inputs. These models use the flattened ARX feature vector q t R L ( m + 1 ) defined in Equation (46). The general ARX baseline mapping can be written as
y ^ t + h = f ARX q t ,
where f ARX ( · ) denotes a nonlinear regression model trained on the vectorized historical window. In this category, Random Forest–ARX, Extra Trees–ARX, and histogram-based gradient boosting ARX were evaluated. Random Forest–ARX represents an ensemble of decision trees trained using bootstrap aggregation [39]. Extra Trees–ARX is a highly randomized tree ensemble that introduces additional randomness in feature and threshold selection [40]. HistGB–ARX is a gradient boosting model that builds an additive ensemble of weak learners in a stage-wise manner [41]. These models test whether nonlinear regression on flattened historical exogenous and autoregressive features is sufficient for the forecasting task.
The third group consists of recurrent and convolutional recurrent sequence learning baselines. The LSTM baseline processes the complete sequence S t R L × ( m + 1 ) directly and predicts the future target value from the final hidden representation:
z LSTM = LSTM S t , y ^ t + h = ϕ LSTM z LSTM .
This baseline evaluates whether recurrent modeling of the full input sequence is sufficient without convolutional local pattern extraction, explicit exogenous–autoregressive separation, adaptive fusion, or residual prediction.
The CNN–LSTM baseline first applies temporal convolution to the complete sequence and then uses an LSTM layer to model longer temporal dependencies:
C CNN = ψ Conv 1 D S t , z CNN LSTM = LSTM C CNN ,
y ^ t + h = ϕ CNN LSTM z CNN LSTM .
This baseline tests whether local temporal feature extraction followed by recurrent modeling can improve forecasting performance without using the proposed dual-branch gated residual formulation.
The fourth group consists of compact Transformer-family time-series baselines. The Transformer baseline uses self-attention to represent temporal interactions within the input sequence:
Z Tr = TransformerEncoder S t , y ^ t + h = ϕ Tr Z Tr , L ,
where Z Tr , L is the encoded representation at the last sequence position. The Informer-style baseline uses an attention-based temporal encoder with sequence-level aggregation to provide a compact long-range dependency model. The PatchTST-style baseline forms temporal patches from the sequence and processes the resulting patch tokens using a Transformer encoder. These Transformer-family baselines were included because attention-based and patch-based architectures are widely used for modern time-series forecasting and provide a stronger comparison than recurrent baselines alone [32,33,42].
Compared with these baselines, the proposed framework differs in three methodological aspects. First, it uses two separate encoders for X t L + 1 : t and Y t L + 1 : t rather than processing all variables through a single flattened vector or a single sequence stream. Second, it adaptively combines the exogenous and autoregressive latent representations using a sample-dependent gate. Third, it predicts a residual correction relative to y t instead of predicting y t + h directly. Therefore, the comparison with the selected baselines evaluates the contribution of residual learning, sequence-preserving representation, adaptive exogenous–autoregressive fusion, and compactness relative to modern sequence learning alternatives.
Table 3 summarizes the evaluated models and the purpose of each comparison.
All evaluated models were trained and tested using the same chronological data partitions, forecasting horizons, preprocessing rules, hyperparameter selection protocol, and evaluation metrics. For the ARX-based baselines, the historical exogenous and target sequences were flattened into q t , whereas for the sequence learning models the temporal structure was preserved. This ensures that performance differences are mainly attributable to the modeling strategy rather than differences in the available historical information.

2.8. Hyperparameter Optimization and Experimental Protocol

A leakage-aware nested blocked hyperparameter optimization and evaluation protocol was adopted to ensure fair model comparison on ordered time-series data, following the principle that validation and testing for time-series forecasting should preserve temporal order [43]. Since the SRU samples are temporally ordered, random splitting was not used because it can mix neighboring samples across training, validation, and test subsets, which may lead to overly optimistic performance estimates. Instead, the data were split chronologically so that model selection and final testing respected the temporal order of the observations.
For each forecasting horizon h { 1 , 5 , 10 } , the supervised dataset D h was evaluated using an outer blocked evaluation loop and an inner blocked validation loop. Let D h , k train and D h , k test denote the outer training and outer test subsets for outer fold k, respectively. The outer test subset was held out and used only once for final performance evaluation. The corresponding outer training subset was further divided chronologically into an inner training subset D h , k inner-train and an inner validation subset D h , k inner-val for hyperparameter selection.
Let λ Λ denote a candidate hyperparameter configuration from the search space Λ . For each candidate configuration, the model parameters were learned on the inner training subset:
θ h , k , λ = arg min θ 1 | D h , k inner-train | ( X , Y , y ) D h , k inner-train L δ y , y ^ θ , λ .
The trained candidate model was then evaluated on the inner validation subset using RMSE:
RMSE h , k , λ val = 1 | D h , k inner-val | ( X , Y , y ) D h , k inner-val y y ^ θ h , k , λ , λ 2 .
The best hyperparameter configuration for horizon h and outer fold k was selected as
λ h , k = arg min λ Λ RMSE h , k , λ val .
After selecting λ h , k , the corresponding model was retrained on the full outer training subset D h , k train and evaluated once on the held-out outer test subset D h , k test . This procedure ensures that the test subset is not used during either model training or hyperparameter selection.
Figure 7 illustrates the nested blocked hyperparameter optimization and evaluation protocol. The outer loop estimates generalization performance, while the inner loop selects hyperparameters using only the training portion of each outer fold.
The complete experimental procedure can be summarized as follows:
  • Construct the supervised forecasting dataset D h for each horizon h { 1 , 5 , 10 } .
  • Split the ordered dataset into chronological outer training and test blocks.
  • Split each outer training block into inner training and inner validation subsets.
  • Train each candidate hyperparameter configuration on the inner training subset.
  • Select the best configuration using the inner validation RMSE.
  • Retrain the selected configuration on the full outer training subset.
  • Evaluate the retrained model once on the held-out outer test subset.
  • Repeat the procedure for all outer folds, forecasting horizons, and evaluated models.
Table 4 summarizes the hyperparameter search space and fixed training settings used in the nested blocked protocol. The search space was defined to cover the main temporal, architectural, and optimization parameters of the ARX, recurrent, convolutional–recurrent, Transformer-family, and proposed models while keeping the comparison computationally tractable.
For the neural models, AdamW optimization was used with the Huber loss defined in Equation (42) [44]. Early stopping was applied based on the inner validation loss to reduce overfitting. The selected configuration for each model, horizon, and outer fold was then trained on the corresponding outer training block and evaluated once on the held-out outer test block. This ensures that the final test results are obtained without using the outer test data for either model fitting or hyperparameter selection.
Table 5 reports the selected hyperparameter configurations obtained from the inner validation procedure. The values in each cell are ordered as ( F 1 , F 2 , F 3 ) , where F 1 , F 2 , and F 3 denote the three outer folds. To keep the table compact, each model is reported once, and the selected configurations are grouped by forecasting horizon. The number of training epochs is not included in the table because neural-network training was controlled using the early-stopping procedure described above.
The selected configurations vary across horizons and folds, reflecting the nonstationary characteristics of the ordered SRU sequence. The tree-based ARX models selected different window lengths across folds, indicating that the useful temporal context changes across chronological regions. The recurrent and convolutional–recurrent models generally selected compact hidden dimensions and short-to-moderate windows. The proposed framework selected moderate window lengths at h = 1 and h = 10 , while selecting a longer window in one fold at h = 5 , suggesting that the effective temporal context depends on both the forecasting horizon and the local operating regime represented by each blocked fold.

2.9. Evaluation Metrics

The predictive performance of each model was evaluated using multiple regression metrics to provide a comprehensive assessment of error magnitude, variance explanation, correlation, and prediction bias. All metrics were computed after transforming the model outputs back to the original normalized scale of the dataset. This ensures that the reported values are directly comparable across models, forecasting horizons, and outer test folds.
Let y i and y ^ i denote the measured and predicted H2S concentration values for sample i, respectively, and let N be the number of test samples. The mean absolute error (MAE) measures the average absolute deviation between measured and predicted values:
MAE = 1 N i = 1 N y i y ^ i .
MAE provides an intuitive measure of the typical prediction error and is less sensitive to rare large deviations than squared error metrics.
The mean squared error (MSE) is defined as
MSE = 1 N i = 1 N y i y ^ i 2 .
The root mean squared error (RMSE) is then computed as
RMSE = 1 N i = 1 N y i y ^ i 2 .
RMSE penalizes larger errors more strongly than MAE because the errors are squared before averaging. Therefore, RMSE is useful for assessing whether a model reduces large prediction deviations, which is important in safety-related concentration forecasting.
The coefficient of determination is computed as
R 2 = 1 i = 1 N y i y ^ i 2 i = 1 N y i y ¯ 2 ,
where
y ¯ = 1 N i = 1 N y i
is the mean of the measured target values in the corresponding test fold. The value of R 2 measures the proportion of target variance explained by the model. A higher R 2 indicates better agreement between measured and predicted values, whereas negative values indicate that the model performs worse than predicting the test fold mean.
The symmetric mean absolute percentage error (sMAPE) was used as the percentage-based error metric:
sMAPE = 100 N i = 1 N 2 y i y ^ i y i + y ^ i + ε ,
where ε is a small positive constant used for numerical stability. Conventional MAPE was not emphasized because the H2S concentration contains values close to zero, which can produce unstable or excessively large percentage errors. sMAPE provides a more stable relative-error measure under this condition.
The median absolute error (MedAE) is defined as
MedAE = median y i y ^ i .
MedAE is a robust measure of the typical prediction error because it is less affected by rare large deviations than mean-based metrics.
The explained variance (EV) is computed as
EV = 1 Var y y ^ Var y ,
where Var ( · ) denotes the sample variance. EV evaluates how much of the variability in the target signal is explained by the predictions while focusing on the variance of the prediction error.
The mean bias deviation (MBD) is defined as
MBD = 1 N i = 1 N y ^ i y i .
A positive MBD indicates average overprediction, whereas a negative MBD indicates average underprediction. Therefore, MBD is useful for identifying systematic prediction bias that may not be obvious from absolute error metrics alone.
Pearson’s correlation coefficient was used to assess the linear agreement between measured and predicted values:
r = i = 1 N y i y ¯ y ^ i y ^ ¯ i = 1 N y i y ¯ 2 i = 1 N y ^ i y ^ ¯ 2 ,
where y ^ ¯ is the mean of the predicted values. Pearson’s r complements the error-based metrics by evaluating how well the predicted temporal variations follow the measured H2S variations.
In addition to absolute performance metrics, the improvement of the proposed model over the naive persistence baseline was computed for lower-is-better error metrics. For an error metric E, the relative improvement is defined as
Improvement ( % ) = 100 × E persistence E proposed E persistence .
A positive value indicates that the proposed model produces a lower error than the persistence baseline, whereas a negative value indicates that the persistence baseline performs better for that metric.
Computational feasibility was also evaluated using model size, trainable parameter count for neural models, tree count and total node count for tree-based models, training time, inference latency, throughput, and real-time feasibility. Inference latency was reported in milliseconds per sample and averaged over repeated inference passes. A model was considered real-time feasible under the adopted criterion if its mean inference latency was below 100 ms per sample.
Graphical analyses were used to complement the numerical metrics. Measured-versus-predicted scatter plots were used to examine point-wise prediction agreement, time-series plots were used to evaluate dynamic tracking behavior, error distribution plots were used to inspect bias and dispersion, and Taylor diagrams were used to compare standard deviation, correlation, and centered error characteristics. Finally, SHAP-based interpretation was used to examine the relative contribution of historical H2S behavior and exogenous airflow variables to the proposed model predictions.

3. Results and Discussion

This section presents the numerical, graphical, computational, and interpretability analyses of the proposed residual exogenous–autoregressive gated forecasting framework. The evaluation is organized around five objectives. First, the proposed framework is compared with persistence, tree-based ARX models, recurrent models, convolutional–recurrent models, and compact Transformer-family baselines across one-step, five-step, and ten-step forecasting horizons. Second, the effect of forecasting horizon is analyzed to examine how prediction difficulty changes as the model forecasts farther into the future. Third, graphical analyses are used to assess point-wise agreement, temporal tracking behavior, prediction error structure, and statistical consistency. Fourth, computational complexity and inference latency are evaluated to assess deployment feasibility for online soft sensing. Finally, SHAP-based interpretation is used to examine how the relative contributions of historical H2S and exogenous airflow variables change with the forecasting horizon.

3.1. Overall Predictive Performance

Table 6 summarizes the predictive performance of the evaluated models across the three forecasting horizons. The results are reported as mean ± standard deviation across the three outer folds of the nested blocked evaluation protocol. The comparison includes the naive persistence predictor, three tree-based ARX models, two recurrent or convolutional–recurrent sequence models, three compact Transformer-family baselines, and the proposed residual gated framework. For MAE, RMSE, sMAPE, and MedAE, lower values indicate better performance; for R 2 , EV, and Pearson’s r, higher values indicate better performance; and for MBD, values closer to zero indicate lower systematic bias.
For the one-step horizon, the proposed framework achieved the strongest overall performance among all evaluated models. It obtained the lowest MAE, RMSE, sMAPE, and MedAE, together with the highest R 2 , EV, and Pearson correlation. The RMSE decreased from 0.0159 ± 0.0052 for persistence to 0.0096 ± 0.0020 for the proposed model, while R 2 increased from 0.9075 ± 0.0356 to 0.9662 ± 0.0037 . The LSTM and CNN–LSTM baselines were the closest competing models, but both produced larger errors than the proposed framework. This result indicates that recurrent modeling alone is useful for short-term H2S forecasting, but the explicit residual decomposition and the separation between target history and airflow dynamics provide additional predictive value.
For the five-step horizon, the proposed framework again achieved the best overall performance. It obtained the lowest MAE of 0.0196 ± 0.0035 , the lowest RMSE of 0.0436 ± 0.0097 , the highest R 2 of 0.2980 ± 0.1171 , and the lowest sMAPE of 22.76 ± 5.99 % . PatchTST was the second-best model in RMSE, with 0.0456 ± 0.0069 , while persistence remained competitive in MAE, MedAE, and Pearson correlation. This behavior is important because it shows that the proposed model does not simply reproduce persistence; rather, it improves the squared error behavior by learning corrections that reduce larger deviations. The improvement is most visible in RMSE and R 2 , which are more sensitive to larger errors and variance explanation than median-based metrics.
For the ten-step horizon, the forecasting task became substantially more difficult. PatchTST obtained the lowest RMSE by a very small margin, with 0.0521 ± 0.0112 , while the proposed framework achieved a nearly identical RMSE of 0.0521 ± 0.0138 and the highest R 2 and EV among all models. Persistence retained the best sMAPE and MedAE at this horizon, indicating that simple carry-forward prediction remains a strong reference for small typical deviations when the target signal is highly persistent. However, persistence produced a much larger RMSE of 0.0604 ± 0.0102 and a negative R 2 , showing that it is less effective at reducing larger deviations and explaining the variance of the future target values. Therefore, the ten-step results indicate a trade-off: persistence provides strong median-level behavior, PatchTST slightly improves RMSE, and the proposed framework provides the best variance-explanation behavior while remaining nearly tied for RMSE.
The performance trends across horizons reveal the increasing difficulty of H2S forecasting as the prediction horizon grows. At h = 1 , the target history provides highly informative short-term continuity, and the proposed model exploits this through the autoregressive branch and residual output structure. At h = 5 , exogenous airflow information becomes more important for correcting deviations from persistence, and the adaptive gate helps combine the target history and airflow representations. At h = 10 , the relationship between current observations and the future target becomes weaker, which explains the lower R 2 values and larger standard deviations across folds. This horizon-dependent degradation is expected in ordered industrial time series because unobserved disturbances, operating regime changes, and delayed process effects accumulate as the forecasting horizon increases.
The proposed model outperformed the other models in several cases because its architecture matches the structure of the forecasting problem. The persistence baseline uses only the latest H2S value and cannot model process-driven corrections. The tree-based ARX models can represent nonlinear relationships but use flattened windows, which lose the explicit sequential structure of the historical trajectory. The LSTM and CNN–LSTM baselines preserve temporal order but process all variables through a single stream, which can mix autoregressive persistence and exogenous correction information. The Transformer-family baselines provide attention-based sequence representations, but their compact forms do not explicitly encode the persistence reference or impose a residual correction structure. In contrast, the proposed framework combines a persistence anchor, separate autoregressive and exogenous encoders, and sample-dependent gated fusion. This allows the model to preserve the strong carry-forward behavior of H2S while learning nonlinear corrections from airflow dynamics when the process state changes.

3.2. Improvement over the Persistence Baseline

Because the proposed framework is formulated as a residual correction around the persistence reference, its performance should be interpreted relative to the naive persistence baseline. Figure 8 reports the percentage improvement of the proposed model over persistence for the main error metrics across the three forecasting horizons.
The proposed framework consistently reduced RMSE relative to persistence across all horizons. The RMSE improvement was 39.7% at h = 1 , 10.0% at h = 5 , and 13.7% at h = 10 . This confirms that the residual operator learned meaningful corrections beyond the carry-forward reference. The largest improvement occurred at the one-step horizon, where the most recent H2S value provides a strong persistence anchor and the model only needs to learn a small nonlinear correction. This is consistent with the residual-learning objective, because the correction term is expected to be easier to approximate when the residual variation is smaller than the full target variation.
At the five-step horizon, the proposed model still improved over persistence, although the improvement was smaller than at h = 1 . This reduction is expected because the future target becomes less directly tied to the most recent observation as the forecasting horizon increases. Nevertheless, the model retained a clear RMSE advantage by using the exogenous airflow branch to correct deviations from persistence. This indicates that airflow-related operating variables provide useful information for medium-horizon H2S forecasting, especially when the target trajectory begins to deviate from simple carry-forward behavior.
At the ten-step horizon, persistence remained competitive for median-level and percentage-based errors because the H2S signal is highly concentrated near low normalized values. However, the proposed framework still reduced RMSE by 13.7%, indicating better control of larger deviations. This distinction is important: persistence can perform well for typical low-concentration samples, but it cannot respond to process-driven changes. The proposed model improves the squared error behavior by combining the persistence reference with learned nonlinear corrections from historical target dynamics and exogenous airflow patterns.

3.3. Computational Complexity and Runtime Analysis

In addition to forecasting accuracy, computational feasibility is important for online soft-sensing applications. Table 7 reports the computational characteristics of the evaluated models, including parameter count or tree complexity, training time, inference latency, throughput, and model size. The values are averaged over the three outer folds for each forecasting horizon. For tree-based models, complexity is represented by the average number of trees and total tree nodes. For neural models, complexity is represented by the number of trainable parameters.
All evaluated models satisfied the adopted real-time feasibility criterion of less than 100 ms per sample. The neural models required only sub-millisecond inference time across all horizons, with inference latencies generally between approximately 0.023 and 0.036 ms per sample. This indicates that the computational burden of the sequence models is small relative to the latency requirements of typical online soft-sensing deployment.
The proposed framework maintained a compact model size across the three horizons. Its average model size was 0.200 MB at h = 1 , 0.142 MB at h = 5 , and 0.206 MB at h = 10 . The corresponding trainable parameter counts were 51,073, 35,713, and 52,609, respectively. These values are modest compared with the Transformer and PatchTST baselines in several horizons, while remaining much smaller in storage footprint than the tree ensemble models. For example, Extra Trees–ARX reached 49.646 MB at h = 1 and 66.276 MB at h = 10 , whereas the proposed model remained below 0.21 MB in all horizons.
The computational results show that the proposed model achieves its accuracy advantages without relying on excessive model size. At h = 1 , the proposed framework achieved the best predictive performance while using fewer parameters than PatchTST and a substantially smaller storage footprint than the tree-based ensembles. At h = 5 , the proposed model achieved the best overall forecasting accuracy and also had the shortest average training time among the neural models. At h = 10 , the proposed model remained nearly tied with PatchTST in RMSE and achieved the highest R 2 and EV, while requiring a smaller model size than PatchTST and lower training time.
These results support the practical relevance of the residual gated design. The model introduces additional structure through separate autoregressive and exogenous encoders, but the resulting computational cost remains moderate. This balance is important for industrial soft sensing, where a forecasting model must provide accurate predictions while also satisfying memory, inference-speed, and deployment constraints.

3.4. Dynamic Tracking and Regression Agreement of the Proposed Model

Figure 9 shows the measured and predicted H2S concentration trajectories obtained by the proposed model across the three forecasting horizons. The one-step prediction closely follows the measured signal and captures both the low-concentration regions and the local variations in the target trajectory. This behavior is consistent with the strong quantitative performance reported in Table 6, where the proposed model achieved the lowest RMSE and highest R 2 at h = 1 .
As the forecasting horizon increases, the predicted trajectory becomes smoother and the mismatch with the measured signal increases. This behavior is expected because longer-horizon forecasting weakens the direct dependence between the current input window and the future target value. At h = 5 , the proposed model still tracks the main concentration pattern and reduces large deviations relative to persistence, which explains its best RMSE and R 2 performance at this horizon. At h = 10 , the model captures the general level of the target signal but has more difficulty following sharp local changes. This confirms that the main challenge at longer horizons is not only point-wise error magnitude but also the reduced predictability of local temporal fluctuations.
Figure 10 presents the measured-versus-predicted regression plots for the proposed model. The scatter distribution at h = 1 is tightly concentrated around the ideal diagonal line, indicating strong agreement between measured and predicted values. At h = 5 , the point cloud becomes more dispersed but remains aligned with the diagonal trend, which supports the conclusion that the model still explains a meaningful part of the target variability. At h = 10 , the dispersion increases further, reflecting the lower temporal determinism of the longer-horizon target. Nevertheless, the proposed model remains close to the best-performing baseline in RMSE and achieves the highest R 2 and EV at this horizon, indicating that it retains useful variance-explanation capability even when the forecasting problem becomes more uncertain.
The graphical results provide insight into why the proposed model outperforms the other models in several cases. The residual connection anchors the prediction to the latest H2S observation, which helps preserve the dominant carry-forward behavior of the target signal. The autoregressive branch captures short-term target continuity, while the exogenous branch allows airflow-related operating changes to modify the residual correction. The adaptive gate then controls the contribution of these two sources at the latent-feature level. This structure is particularly effective at h = 1 and h = 5 , where both target persistence and exogenous process information remain informative. At h = 10 , the task becomes less deterministic, and the benefit of the residual correction is reduced but not eliminated, as shown by the RMSE improvement over persistence and the highest variance-explanation metrics.

3.5. Prediction Error Distribution and Absolute Error Analysis

The prediction error distribution of the proposed model is shown in Figure 11. This analysis complements the aggregate metrics by showing how the residual errors are distributed around zero for each forecasting horizon. At the one-step horizon, the error distribution is narrow and centered close to zero, which agrees with the low RMSE, low MAE, and near-zero MBD reported in Table 6. This indicates that the proposed model provides accurate short-term forecasts without introducing a strong systematic bias.
As the forecasting horizon increases, the error distribution becomes wider, reflecting the greater uncertainty of medium- and longer-horizon prediction. At h = 5 , the proposed model still maintains a relatively concentrated error distribution and achieves the best RMSE and R 2 among all evaluated models. This suggests that the residual gated architecture reduces not only average error but also larger deviations that contribute strongly to RMSE. At h = 10 , the error spread increases further, which is consistent with the lower R 2 values observed across all models. The small positive MBD at this horizon indicates a slight tendency toward overprediction, but the bias remains small relative to the overall error dispersion.
Figure 12 shows the absolute error of the proposed model over the ordered test samples for the three forecasting horizons. This temporal error view is useful because it reveals whether the model produces uniformly distributed deviations or localized error bursts. At h = 1 , the absolute error remains low for most samples, confirming the ability of the proposed residual formulation to follow the short-term H2S dynamics. The few localized peaks correspond to intervals where the measured concentration changes more abruptly, which are more difficult to predict from the recent historical window.
At the five-step horizon, the absolute error increases compared with the one-step case, but the proposed model still controls large deviations better than the persistence baseline, as reflected by its lower RMSE. This behavior shows that the model benefits from combining the persistence reference with exogenous airflow information when the target begins to deviate from simple carry-forward behavior. At the ten-step horizon, the absolute error curve becomes more irregular and contains larger localized deviations, indicating that the relationship between the current input window and the future target becomes weaker as the horizon increases. Nevertheless, the proposed model continues to reduce RMSE relative to persistence and remains nearly tied with the best baseline, showing that the residual correction remains useful even under increased temporal uncertainty.
Together, the error distribution and absolute error analyses show that the proposed model is strongest when the forecasting horizon is short or medium. In these cases, the autoregressive branch captures the dominant target continuity, while the exogenous branch provides corrective information from airflow dynamics. At longer horizons, the reduced predictability of local H2S fluctuations limits all models, but the proposed framework maintains competitive performance by preserving the persistence anchor and learning nonlinear residual corrections.

3.6. Taylor Diagram Analysis

Taylor diagrams [45] were used to provide a compact graphical comparison of correlation, standard deviation, and centered root mean square difference between the measured and predicted H2S concentration values. This analysis complements the numerical metrics because two models can have similar RMSE values while exhibiting different correlation behavior or different variance-matching characteristics. Figure 13 shows the Taylor diagrams for the three forecasting horizons.
At the one-step horizon, the proposed model is located closest to the reference point, indicating the best overall balance between correlation, variance representation, and centered error. This agrees with the numerical results in Table 6, where the proposed model achieved the highest Pearson correlation and the lowest RMSE. The LSTM and CNN–LSTM baselines also show strong short-horizon agreement, confirming that recurrent temporal modeling is suitable for capturing local H2S continuity. However, their larger centered errors indicate that temporal encoding alone is not sufficient to match the measured trajectory as accurately as the proposed residual gated formulation.
At the five-step horizon, the Taylor diagram shows a wider separation among the models, reflecting the increased difficulty of medium-horizon forecasting. The proposed model remains among the closest models to the reference point and provides the best RMSE and R 2 in the numerical evaluation. Although the persistence baseline retains a strong correlation at this horizon, its larger RMSE indicates that it does not sufficiently correct the amplitude of larger deviations. This distinction explains why the proposed model improves squared error behavior while persistence remains competitive in correlation and median-level error. The proposed residual formulation is therefore useful because it preserves the carry-forward structure of the target while allowing the exogenous airflow branch to adjust the forecast when the process deviates from persistence.
At the ten-step horizon, all models move farther from the reference point, indicating reduced correlation and larger centered deviations. This confirms that long-horizon H2S forecasting is substantially more uncertain than one-step forecasting. PatchTST, Transformer, persistence, and the proposed model form the strongest group at this horizon, but no model achieves the level of agreement observed at shorter horizons. The proposed model remains highly competitive and achieves the highest R 2 and EV, while PatchTST obtains a marginally lower RMSE. This suggests that attention-based patch representations can be effective for longer-horizon sequence abstraction, whereas the proposed residual gated framework retains stronger variance-explanation behavior.
Overall, the Taylor diagrams support the main conclusion obtained from the numerical results. The proposed framework is most effective at short and medium horizons, where both target persistence and exogenous airflow corrections remain informative. At the longest horizon, the available input window contains less deterministic information about the future H2S value, so the performance gap between the strongest models becomes smaller. The Taylor analysis therefore confirms that the advantage of the proposed method is not limited to a single error metric but is reflected in its combined behavior in terms of correlation, centered error, and variance representation.

3.7. SHAP-Based Horizon-Wise Interpretability Analysis

SHAP analysis was used to interpret the proposed model predictions and to examine how the importance of historical H2S and exogenous airflow variables changes with the forecasting horizon. This analysis is particularly important because the proposed framework contains two different information sources: the autoregressive target history branch and the exogenous airflow branch. Therefore, the SHAP results help clarify whether the model relies mainly on persistence information, process-input information, or a horizon-dependent combination of both.
For each forecasting horizon, SHAP values were computed for the input features of the proposed model. The contribution of a feature group was summarized using the mean absolute SHAP value:
I g ( h ) = 1 N i = 1 N j G g ϕ i , j ( h ) ,
where I g ( h ) denotes the importance of group g at horizon h, ϕ i , j ( h ) is the SHAP value of feature j for sample i, and G g is the set of features belonging to group g. The feature groups correspond to historical H2S information and the five exogenous airflow variables.
Figure 14 shows that historical H2S information is the dominant contributor at the one-step horizon. This result is consistent with the strong temporal persistence of the target signal and with the high performance of the persistence baseline at short horizons. However, the proposed model improves over persistence because it does not rely only on the latest target value; instead, it learns a nonlinear residual correction using both target history dynamics and airflow-related variables. This explains why the proposed framework achieved the best one-step RMSE and R 2 while preserving a very small bias.
As the forecasting horizon increases, the relative influence of exogenous airflow variables becomes more important. This behavior is expected in SRU soft sensing because airflow-related variables reflect operating conditions that can affect future H2S concentration through delayed process responses. At short horizons, the most recent H2S value is highly informative, but at medium and longer horizons, deviations from persistence become more dependent on changes in the process inputs. The SHAP results therefore support the architectural design of the proposed model: the autoregressive branch captures the dominant target continuity, while the exogenous branch provides corrective information when future concentration levels are influenced by airflow dynamics.
Figure 15 further illustrates the horizon-dependent shift in feature-group contribution. The contribution of historical H2S is strongest at the shortest horizon, where the future value is closely linked to the current target state. In contrast, airflow-related variables provide increasing corrective information as the forecasting horizon becomes longer. This trend is physically meaningful because SRU gas concentration dynamics are not determined only by the latest concentration measurement; they are also affected by the recent evolution of air supply and zone-specific flow conditions. Therefore, the proposed gated fusion mechanism is useful because it allows the model to adjust the balance between autoregressive persistence and exogenous process information according to the local input pattern and forecasting horizon.
The SHAP interpretation also explains the performance differences among the baselines. Persistence performs well when historical H2S dominates, but it cannot use airflow-related process changes. Tree-based ARX models can use exogenous variables, but they treat the time window as a flattened feature vector and therefore do not explicitly model sequential target dynamics. Single-stream neural baselines can learn temporal relationships, but they do not explicitly separate autoregressive and exogenous information before fusion. The proposed model benefits from this separation because the gate can emphasize target history information when the signal is locally persistent and increase the influence of airflow representations when process-driven corrections are needed. This interpretation supports the numerical results, where the proposed framework shows its clearest advantage at the one-step and five-step horizons and remains competitive at the ten-step horizon.

3.8. Practical Implications, Generalizability, and Limitations

The results have several practical implications for industrial soft sensing. First, the proposed framework provides accurate short- and medium-horizon H2S forecasts while maintaining a small computational footprint and sub-millisecond inference latency. This is important for online monitoring applications, where the forecasting model must operate continuously without introducing significant computational delays. The compact model size also makes the approach suitable for deployment on standard industrial workstations or edge-computing platforms connected to plant monitoring systems.
Second, the residual formulation provides a useful modeling structure for persistent industrial time series. In the SRU dataset, the H2S concentration exhibits strong short-term continuity, making the latest target value a strong reference point. The proposed model benefits from this property by predicting a nonlinear correction around the persistence reference rather than predicting the future concentration entirely from scratch. This explains why the framework performs particularly well at h = 1 and h = 5 , where the residual correction remains strongly related to the recent target history and airflow dynamics.
Third, the dual-branch structure improves interpretability at the architectural level. The autoregressive branch represents historical H2S behavior, whereas the exogenous branch represents airflow-related operating conditions. The adaptive gate then combines these two sources using a sample-dependent latent weighting mechanism. This design is consistent with the SHAP analysis, which shows that historical H2S dominates short-horizon prediction, while airflow-related variables become more influential as the forecasting horizon increases. Therefore, the model behavior is not only numerically effective but also physically meaningful for SRU soft sensing.
The proposed framework is not restricted to H2S forecasting. It can be applied to other nonlinear dynamic forecasting problems where the target variable is persistent and exogenous variables provide delayed corrective information. Examples include gas concentration monitoring, temperature forecasting, emission monitoring, process quality prediction, and other industrial soft-sensing tasks. The key requirement is that the future target can be meaningfully represented as a persistence component plus a learnable residual correction influenced by historical target and exogenous process variables.
However, several limitations should be noted. First, the experimental validation was conducted on one public SRU dataset. Although the nested blocked evaluation protocol reduces temporal leakage and provides a stronger estimate of generalization within the available sequence, additional validation on other industrial datasets would be needed to fully assess cross-process generalizability. Second, the proposed model was evaluated using compact implementations of Transformer-family baselines. While these baselines provide a meaningful comparison under the same data protocol and computational setting, future work may include larger-scale official implementations and broader benchmark datasets.
Third, the forecasting difficulty increases substantially at longer horizons. At h = 10 , the proposed model remained competitive and achieved the highest R 2 and EV, but PatchTST obtained a marginally lower RMSE and persistence remained strong for median-level error. This indicates that longer-horizon H2S forecasting is limited by reduced temporal determinism and possible unobserved disturbances. Therefore, the residual gated structure is most advantageous when the residual dynamics remain learnable from the available target history and exogenous input window.
Finally, the present study focuses on deterministic point forecasting. In practical industrial monitoring, uncertainty estimates can be valuable for risk-aware decision support, especially when forecasting farther into the future. Future work may extend the proposed framework using probabilistic forecasting, prediction intervals, uncertainty-aware residual learning, or adaptive online updating under changing operating regimes.

4. Conclusions

This study proposed a residual exogenous–autoregressive gated forecasting framework for multi-horizon H2S concentration prediction in sulfur recovery units. The method was designed for persistent nonlinear dynamic time series in which the latest target observation provides a strong forecasting reference, while exogenous process variables provide horizon-dependent corrective information. The proposed framework decomposes the forecast into a persistence component and a learnable nonlinear residual correction. Historical H2S dynamics and airflow-related process variables are encoded using two dedicated CNN–LSTM branches, and their latent representations are combined through a sample-dependent sigmoid gating mechanism.
The proposed model was evaluated using a leakage-aware nested blocked protocol over three forecasting horizons: one-step, five-step, and ten-step ahead prediction. The results showed that the proposed framework achieved the best overall performance at the one-step and five-step horizons. It obtained RMSE values of 0.0096 ± 0.0020 at h = 1 and 0.0436 ± 0.0097 at h = 5 , corresponding to RMSE reductions of 39.7% and 10.0% relative to the naive persistence baseline. At the ten-step horizon, the forecasting task became more challenging, and PatchTST obtained a marginally lower RMSE. Nevertheless, the proposed framework remained highly competitive, with an RMSE of 0.0521 ± 0.0138 , a 13.7% RMSE reduction over persistence, and the highest R 2 and explained variance among the evaluated models.
The results demonstrate that the residual gated formulation is particularly effective when the future target remains strongly related to recent H2S history while still requiring correction from exogenous airflow dynamics. The comparison with persistence confirmed that the proposed residual operator learns meaningful deviations beyond simple carry-forward prediction. The comparison with tree-based ARX, recurrent, convolutional–recurrent, and compact Transformer-family baselines further showed that separating autoregressive target history information from exogenous process information provides a useful modeling structure for SRU soft sensing.
The graphical analyses supported the numerical findings. Time-series and measured-versus-predicted plots showed strong short-horizon tracking and increasing dispersion as the forecasting horizon increased. Error distribution and absolute error analyses indicated that the proposed model reduces larger deviations, especially at short and medium horizons. Taylor diagrams confirmed that the proposed method provides a favorable balance between correlation, centered error, and variance representation. SHAP analysis further showed that historical H2S information dominates short-horizon prediction, while airflow-related variables become more influential as the forecasting horizon increases. This horizon-dependent interpretation is consistent with the physical behavior of dynamic SRU operation, where delayed process effects become more important farther into the future.
The computational analysis showed that the proposed model achieves these accuracy gains with a compact architecture and sub-millisecond inference latency. The model size remained below 0.21 MB across all horizons, supporting its feasibility for online soft-sensing applications. These findings suggest that the proposed residual exogenous–autoregressive gated framework provides an accurate, interpretable, and computationally efficient approach for H2S forecasting in persistent nonlinear industrial processes.
Future work will focus on validating the framework on additional industrial datasets, extending the method to probabilistic forecasting with prediction intervals, and investigating adaptive online updating under changing operating regimes. Broader benchmarking against large-scale official Transformer-family implementations and other industrial time-series datasets would also help further assess the generalizability of the proposed residual gated design.

Funding

This research was funded by ongoing research funding program, (ORF-2026-2179), King Saud University, Riyadh, Saudi Arabia.

Data Availability Statement

The SRU H2S dataset used in this study is publicly available through Mendeley Data [37]. The source code used to implement the proposed residual exogenous–autoregressive gated forecasting framework, baseline models, leakage-aware blocked evaluation protocol, computational analysis, and publication figures is available at https://github.com/alfhdan/sru-h2s-residual-gated-forecasting (accessed on 19 July 2026).

Conflicts of Interest

The author declares no conflicts of interest.

References

  1. Fortuna, L.; Graziani, S.; Rizzo, A.; Xibilia, M.G. Soft Sensors for Monitoring and Control of Industrial Processes; Springer: London, UK, 2007. [Google Scholar]
  2. Kadlec, P.; Gabrys, B.; Strandt, S. Data-driven soft sensors in the process industry. Comput. Chem. Eng. 2009, 33, 795–814. [Google Scholar] [CrossRef]
  3. Perera, Y.S.; Ratnaweera, D.A.A.C.; Dasanayaka, C.H.; Abeykoon, C. The role of artificial intelligence-driven soft sensors in advanced sustainable process industries: A critical review. Eng. Appl. Artif. Intell. 2023, 121, 105988. [Google Scholar] [CrossRef]
  4. Cao, L.; Wang, J.; Su, J.; Luo, Y.; Cao, Y.; Braatz, R.D.; Gopaluni, B. Comprehensive analysis on machine learning approaches for interpretable and stable soft sensors. IEEE Trans. Instrum. Meas. 2025, 74, 9517217. [Google Scholar] [CrossRef]
  5. Pudi, A.; Rezaei, M.; Signorini, V.; Andersson, M.P.; Baschetti, M.G.; Mansouri, S.S. Hydrogen sulfide capture and removal technologies: A comprehensive review of recent developments and emerging trends. Sep. Purif. Technol. 2022, 298, 121448. [Google Scholar] [CrossRef]
  6. Chan, Y.H.; Loy, A.C.M.; Cheah, K.W.; Chai, S.Y.W.; Ngu, L.H.; How, B.S.; Li, C.; Lock, S.S.M.; Wong, M.K.; Yiin, C.L.; et al. Hydrogen sulfide (H2S) conversion to hydrogen (H2) and value-added chemicals: Progress, challenges and outlook. Chem. Eng. J. 2023, 458, 141398. [Google Scholar] [CrossRef]
  7. Zhang, X.; Tang, Y.; Qu, S.; Da, J.; Hao, Z. H2S-Selective Catalytic Oxidation: Catalysts and Processes. ACS Catal. 2015, 5, 1053–1067. [Google Scholar] [CrossRef]
  8. Manenti, F.; Papasidero, D.; Bozzano, G.; Ranzi, E. Model-based optimization of sulfur recovery units. Comput. Chem. Eng. 2014, 66, 244–251. [Google Scholar] [CrossRef]
  9. Kazempour, H.; Pourfayaz, F.; Mehrpooya, M. Modeling and multi-optimization of thermal section of Claus process based on kinetic model. J. Nat. Gas. Sci. Eng. 2017, 38, 235–244. [Google Scholar] [CrossRef]
  10. Ghahraloud, H.; Farsi, M.; Rahimpour, M. Modeling and optimization of an industrial Claus process: Thermal and catalytic section. J. Taiwan Inst. Chem. Eng. 2017, 76, 1–9. [Google Scholar] [CrossRef]
  11. Rahman, R.K.; Ibrahim, S.; Raj, A. Multi-objective optimization of sulfur recovery units using a detailed reaction mechanism to reduce energy consumption and destruct feed contaminants. Comput. Chem. Eng. 2019, 128, 21–34. [Google Scholar] [CrossRef]
  12. Duque, H.; Diao, K.; Villa, R.; Leitão, J.P.; Djordjević, S.; Abdel-Aal, M. Context-aware data driven sensor data analysis: With application to H2S concentration prediction in urban drainage networks. Water Res. X 2025, 28, 100346. [Google Scholar] [CrossRef]
  13. Kychkin, A.; Chernitsin, I.; Vikentyeva, O. Development the reinforcement learning model for sources identification of H2S industrial emissions. In Proceedings of the International Conference on Industrial Engineering, Applications and Manufacturing (ICIEAM), Sochi, Russia, 12–16 May 2025. [Google Scholar]
  14. Johni, A.K.; OmidbakhshAmiri, E. Simulation and multi-objective optimization of Claus process of sulfur recovery unit. J. Environ. Chem. Eng. 2023, 11, 110969. [Google Scholar] [CrossRef]
  15. Khan, I.; Saghir, H.; Ahsan, M. Machine learning-enabled prediction and optimization of sulfur recovery units: A step towards Industry 4.0 integration. Mater. Proc. 2024, 17, 6. [Google Scholar] [CrossRef]
  16. Ge, Z.; Song, Z. Nonlinear soft sensor development based on relevance vector machine. Ind. Eng. Chem. Res. 2010, 49, 8685–8693. [Google Scholar] [CrossRef]
  17. Bidar, B.; Shahraki, F.; Sadeghi, J.; Khalilipour, M.M. Soft sensor modeling based on multi-state-dependent parameter models and application for quality monitoring in industrial sulfur recovery process. IEEE Sens. J. 2018, 18, 4583–4591. [Google Scholar] [CrossRef]
  18. Tavakoli Dastjerd, F.; Shahraki, F.; Sadeghi, J.; Khalilipour, M.M.; Bidar, B. Tail gas quality warning system in a sulfur recovery unit based on. Int. J. Ind. Electron. Control Optim. 2023, 6, 307–319. [Google Scholar] [CrossRef]
  19. LeCun, Y.; Bengio, Y.; Hinton, G. Deep learning. Nature 2015, 521, 436–444. [Google Scholar] [CrossRef] [PubMed]
  20. Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef] [PubMed]
  21. Yuan, X.; Li, L.; Wang, Y. Nonlinear dynamic soft sensor modeling with supervised long short-term memory network. IEEE Trans. Ind. Inform. 2020, 16, 3168–3176. [Google Scholar] [CrossRef]
  22. Zhang, T.; Song, S.; Li, S.; Ma, L.; Pan, S.; Han, L. Research on gas concentration prediction models based on LSTM multidimensional time series. Energies 2019, 12, 161. [Google Scholar] [CrossRef]
  23. Recio-Colmenares, R.; León Becerril, E.; Gurubel Tun, K.J.; Conchas, R.F. Design of a soft sensor based on long short-term memory artificial neural network (LSTM) for wastewater treatment plants. Sensors 2023, 23, 9236. [Google Scholar] [CrossRef] [PubMed]
  24. Yuan, X.; Li, L.; Wang, Y.; Yang, C.; Gui, W. Deep learning for quality prediction of nonlinear dynamic processes with variable attention-based long short-term memory network. Can. J. Chem. Eng. 2020, 98, 1377–1389. [Google Scholar]
  25. Shen, F.; Zheng, J.; Ye, L.; Ma, X. LSTM soft sensor development of batch processes with multivariate trajectory based ensemble just-in-time learning. IEEE Access 2020, 8, 73855–73864. [Google Scholar] [CrossRef]
  26. Zheng, J.; Ma, L.; Wu, Y.; Ye, L.; Shen, F. Nonlinear dynamic soft sensor development with a supervised hybrid CNN-LSTM network for industrial processes. ACS Omega 2022, 7, 16653–16664. [Google Scholar] [CrossRef] [PubMed]
  27. Zha, W.; Liu, Y.; Wan, Y.; Luo, R.; Li, D.; Yang, S.; Xu, Y. Forecasting monthly gas field production based on the CNN-LSTM model. Energy 2022, 260, 124889. [Google Scholar] [CrossRef]
  28. Junior, J.S.S.; Mendes, J.; Souza, F.; Premebida, C. Hybrid LSTM-fuzzy system to model a sulfur recovery unit. In Proceedings of the 20th International Conference on Informatics in Control, Automation and Robotics; SciTePress: Rome, Italy, 2023; Volume 2, pp. 281–288. [Google Scholar] [CrossRef]
  29. Sun, W.; Li, L.; Lu, B.; Jiang, L.; Zhang, J. Hybrid multiscale forecasting of SRU sulfur gas concentrations using VMD, CEEMDAN and optimized PatchTST. iScience 2026, 29, 114986. [Google Scholar] [CrossRef] [PubMed]
  30. Dragomiretskiy, K.; Zosso, D. Variational mode decomposition. IEEE Trans. Signal Process. 2014, 62, 531–544. [Google Scholar] [CrossRef]
  31. Torres, M.E.; Colominas, M.A.; Schlotthauer, G.; Flandrin, P. A complete ensemble empirical mode decomposition with adaptive noise. In Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Prague, Czech Republic, 22–27 May 2011; pp. 4144–4147. [Google Scholar]
  32. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. Adv. Neural Inf. Process. Syst. 2017, 30, 5998–6008. [Google Scholar]
  33. Nie, Y.; Nguyen, N.H.; Sinthong, P.; Kalagnanam, J. A time series is worth 64 words: Long-term forecasting with transformers. In Proceedings of the International Conference on Learning Representations (ICLR), Kigali, Rwanda, 1–5 May 2023. [Google Scholar]
  34. Yuan, X.; Wang, Y.; Yang, C.; Gui, W. Stacked isomorphic autoencoder based soft analyzer and its application to sulfur recovery unit. Inf. Sci. 2020, 534, 72–84. [Google Scholar] [CrossRef]
  35. Wang, Q.; Li, L. Research on semi-supervised soft sensor modeling method for sulfur recovery unit based on ISSA-VMD-ESN. Chem. Eng. Sci. 2024, 298, 120397. [Google Scholar] [CrossRef]
  36. Mou, T.; Liu, J.; Zou, Y.; Li, S.; Xibilia, M.G. Enhanced industrial process modeling with transfer-incremental-learning: A parallel SAE approach and its application to a sulfur recovery unit. Control Eng. Pract. 2024, 148, 105955. [Google Scholar] [CrossRef]
  37. Sun, W. Industrial Sulfur Gas Concentration Dataset for SRU Forecasting. Mendeley Data 2026, 1. [Google Scholar] [CrossRef]
  38. Huber, P.J. Robust estimation of a location parameter. Ann. Math. Stat. 1964, 35, 73–101. [Google Scholar] [CrossRef]
  39. Breiman, L. Random forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef]
  40. Geurts, P.; Ernst, D.; Wehenkel, L. Extremely randomized trees. Mach. Learn. 2006, 63, 3–42. [Google Scholar] [CrossRef]
  41. Friedman, J.H. Greedy function approximation: A gradient boosting machine. Ann. Stat. 2001, 29, 1189–1232. [Google Scholar] [CrossRef]
  42. Zhou, H.; Zhang, S.; Peng, J.; Zhang, S.; Li, J.; Xiong, H.; Zhang, W. Informer: Beyond efficient transformer for long sequence time-series forecasting. Proc. AAAI Conf. Artif. Intell. 2021, 35, 11106–11115. [Google Scholar] [CrossRef]
  43. Bergmeir, C.; Hyndman, R.J.; Koo, B. A note on the validity of cross-validation for evaluating autoregressive time series prediction. Comput. Stat. Data Anal. 2018, 120, 70–83. [Google Scholar] [CrossRef]
  44. Loshchilov, I.; Hutter, F. Decoupled weight decay regularization. In Proceedings of the International Conference on Learning Representations, New Orleans, LA, USA, 6–9 May 2019. [Google Scholar]
  45. Taylor, K.E. Summarizing multiple aspects of model performance in a single diagram. J. Geophys. Res. Atmos. 2001, 106, 7183–7192. [Google Scholar] [CrossRef]
Figure 1. Overview of the methodological workflow adopted in this study. The workflow starts with industrial SRU process data, followed by data preprocessing, exploratory data analysis, machine learning modeling, performance evaluation, and model interpretation.
Figure 1. Overview of the methodological workflow adopted in this study. The workflow starts with industrial SRU process data, followed by data preprocessing, exploratory data analysis, machine learning modeling, performance evaluation, and model interpretation.
Mathematics 14 02878 g001
Figure 2. Histogram distributions of the selected normalized SRU process variables and H2S concentration.
Figure 2. Histogram distributions of the selected normalized SRU process variables and H2S concentration.
Mathematics 14 02878 g002
Figure 3. Violin plots of the selected normalized SRU process variables and H2S concentration. The central markers indicate the median, interquartile range, and mean of each variable.
Figure 3. Violin plots of the selected normalized SRU process variables and H2S concentration. The central markers indicate the median, interquartile range, and mean of each variable.
Mathematics 14 02878 g003
Figure 4. Pearson correlation matrix of the SRU input features.
Figure 4. Pearson correlation matrix of the SRU input features.
Mathematics 14 02878 g004
Figure 5. Architecture of the proposed residual exogenous–autoregressive gated forecasting framework. The model separately encodes exogenous input dynamics and autoregressive target history dynamics using two CNN-LSTM branches. A sample-dependent gate adaptively fuses the two latent representations, and a residual prediction head estimates the correction term added to the most recent target observation.
Figure 5. Architecture of the proposed residual exogenous–autoregressive gated forecasting framework. The model separately encodes exogenous input dynamics and autoregressive target history dynamics using two CNN-LSTM branches. A sample-dependent gate adaptively fuses the two latent representations, and a residual prediction head estimates the correction term added to the most recent target observation.
Mathematics 14 02878 g005
Figure 6. Internal structure of the CNN-LSTM encoder used in the exogenous and autoregressive branches. The Conv1D layer captures local temporal variations, the activation and dropout layers provide nonlinear transformation and regularization, and the LSTM layer captures sequential dependencies before producing the branch-level latent representation.
Figure 6. Internal structure of the CNN-LSTM encoder used in the exogenous and autoregressive branches. The Conv1D layer captures local temporal variations, the activation and dropout layers provide nonlinear transformation and regularization, and the LSTM layer captures sequential dependencies before producing the branch-level latent representation.
Mathematics 14 02878 g006
Figure 7. Nested blocked hyperparameter optimization and evaluation protocol. For each outer fold, the test block is held out for final evaluation, while the outer training block is divided into inner training and validation subsets for hyperparameter selection. The best configuration is retrained on the full outer training block and evaluated once on the outer test block.
Figure 7. Nested blocked hyperparameter optimization and evaluation protocol. For each outer fold, the test block is held out for final evaluation, while the outer training block is divided into inner training and validation subsets for hyperparameter selection. The best configuration is retrained on the full outer training block and evaluated once on the outer test block.
Mathematics 14 02878 g007
Figure 8. Percentage improvement of the proposed model over the naive persistence baseline across the three forecasting horizons. Positive values indicate lower error than persistence.
Figure 8. Percentage improvement of the proposed model over the naive persistence baseline across the three forecasting horizons. Positive values indicate lower error than persistence.
Mathematics 14 02878 g008
Figure 9. Measured and predicted H2S concentration trajectories of the proposed model across the three forecasting horizons: (top) one-step ahead, (middle) five-step ahead, and (bottom) ten-step ahead.
Figure 9. Measured and predicted H2S concentration trajectories of the proposed model across the three forecasting horizons: (top) one-step ahead, (middle) five-step ahead, and (bottom) ten-step ahead.
Mathematics 14 02878 g009
Figure 10. Measured-versus-predicted H2S concentration plots for the proposed model across the three forecasting horizons: (left) one-step ahead, (middle) five-step ahead, and (right) ten-step ahead. The diagonal line indicates ideal prediction agreement.
Figure 10. Measured-versus-predicted H2S concentration plots for the proposed model across the three forecasting horizons: (left) one-step ahead, (middle) five-step ahead, and (right) ten-step ahead. The diagonal line indicates ideal prediction agreement.
Mathematics 14 02878 g010
Figure 11. Prediction-error distributions of the proposed model across the three forecasting horizons: (left) one-step ahead, (middle) five-step ahead, and (right) ten-step ahead.
Figure 11. Prediction-error distributions of the proposed model across the three forecasting horizons: (left) one-step ahead, (middle) five-step ahead, and (right) ten-step ahead.
Mathematics 14 02878 g011
Figure 12. Absolute error over the ordered test samples for the proposed model across the three forecasting horizons: (top) one-step ahead, (middle) five-step ahead, and (bottom) ten-step ahead.
Figure 12. Absolute error over the ordered test samples for the proposed model across the three forecasting horizons: (top) one-step ahead, (middle) five-step ahead, and (bottom) ten-step ahead.
Mathematics 14 02878 g012
Figure 13. Taylor diagrams comparing the evaluated forecasting models across the three prediction horizons: (left) one-step ahead, (middle) five-step ahead, and (right) ten-step ahead. The diagrams summarize the relationship between standard deviation, centered RMSE, and Pearson correlation relative to the measured H2S concentration.
Figure 13. Taylor diagrams comparing the evaluated forecasting models across the three prediction horizons: (left) one-step ahead, (middle) five-step ahead, and (right) ten-step ahead. The diagrams summarize the relationship between standard deviation, centered RMSE, and Pearson correlation relative to the measured H2S concentration.
Mathematics 14 02878 g013
Figure 14. Horizon-wise SHAP interpretation of the proposed model for H2S forecasting. The figure summarizes grouped SHAP importance and SHAP beeswarm distributions for the one-step, five-step, and ten-step ahead forecasting horizons.
Figure 14. Horizon-wise SHAP interpretation of the proposed model for H2S forecasting. The figure summarizes grouped SHAP importance and SHAP beeswarm distributions for the one-step, five-step, and ten-step ahead forecasting horizons.
Mathematics 14 02878 g014
Figure 15. Grouped SHAP importance trend across forecasting horizons for the proposed model. The trend illustrates the changing relative contribution of historical H2S information and exogenous airflow variables as the prediction horizon increases.
Figure 15. Grouped SHAP importance trend across forecasting horizons for the proposed model. The trend illustrates the changing relative contribution of historical H2S information and exogenous airflow variables as the prediction horizon increases.
Mathematics 14 02878 g015
Table 1. Statistical summary of the SRU H2S dataset.
Table 1. Statistical summary of the SRU H2S dataset.
FeatureMeanStd. Dev.SumMinMedianMax
MEA airflow0.56230.20545668.78200.00000.55021.0000
SWS airflow0.56230.22775668.27190.00000.58571.0000
Airflow in MEA zone0.44610.15194497.10440.00000.44941.0000
Airflow in SWS zone0.59400.24205988.45230.00000.72251.0000
Secondary airflow0.60110.20296059.25960.00000.69531.0000
H2S concentration0.08070.0530813.61290.00000.07341.0000
Table 2. Main components of the proposed residual exogenous–autoregressive gated forecasting framework.
Table 2. Main components of the proposed residual exogenous–autoregressive gated forecasting framework.
ComponentInputOperationOutput
Exogenous encoder X t L + 1 : t R L × m Temporal convolution, activation, dropout, and LSTM encoding z x R d
Autoregressive encoder Y t L + 1 : t R L × 1 Temporal convolution, activation, dropout, and LSTM encoding z y R d
Adaptive gate [ z y ; z x ] R 2 d Fully connected transformation followed by sigmoid activation g t [ 0 , 1 ] d
Gated fusion z x , z y , and  g t Element-wise latent interpolation z f , t R d
Residual head z f , t Fully connected nonlinear regression mapping Δ y ^ t + h
Final prediction y t and Δ y ^ t + h Residual addition y ^ t + h
Table 3. Summary of the evaluated forecasting models.
Table 3. Summary of the evaluated forecasting models.
ModelCategoryPurpose of Comparison
Naive persistenceReference predictorTests whether the proposed residual operator learns useful corrections beyond direct carry-forward prediction.
Random Forest-ARXTree-based nonlinear ARX modelEvaluates nonlinear ensemble regression using flattened historical exogenous and autoregressive features.
Extra Trees-ARXRandomized tree-based ARX modelTests whether additional randomization in tree ensembles improves nonlinear forecasting from vectorized ARX features.
HistGB-ARXBoosting-based ARX modelEvaluates additive boosted-tree regression using the same flattened temporal information.
LSTMSingle-stream recurrent sequence modelTests recurrent temporal modeling of the full sequence without convolution, residual prediction, or exogenous–autoregressive separation.
CNN-LSTMSingle-stream convolutional
–recurrent model
Tests local temporal feature extraction followed by recurrent modeling without dual-branch gated residual fusion.
TransformerAttention-based sequence modelEvaluates self-attention-based temporal representation of the full input sequence.
InformerCompact attention-based sequence modelEvaluates an attention-based long-range dependency baseline with sequence-level aggregation.
PatchTSTPatch-based Transformer sequence modelEvaluates patch-level temporal tokenization and attention-based forecasting.
Proposed frameworkResidual gated exogenous–
autoregressive model
Tests whether residual prediction, dual-branch temporal encoding, and adaptive gated fusion improve multi-horizon forecasting.
Table 4. Hyperparameter search space and fixed training settings used in the nested blocked evaluation protocol.
Table 4. Hyperparameter search space and fixed training settings used in the nested blocked evaluation protocol.
Model GroupHyperparameterCandidate/Fixed Values
All window-based modelsWindow length L { 10 , 20 , 30 , 50 }
Random Forest-ARXNumber of trees { 200 , 250 , 300 }
Maximum tree depth { None , 10 , 20 }
Minimum samples per leaf { 1 , 3 , 5 }
Extra Trees-ARXNumber of trees { 200 , 250 , 300 }
Maximum tree depth { None , 10 , 20 }
Minimum samples per leaf { 1 , 3 , 5 }
HistGB-ARXLearning rate { 0.03 , 0.05 , 0.08 }
Maximum leaf nodes { 15 , 31 }
Maximum iterations { 200 , 250 , 300 , 400 }
LSTMLSTM hidden units { 32 , 64 }
LSTM layers1
Dropout rate { 0.1 , 0.2 }
Learning rate { 10 3 , 5 × 10 4 }
Batch size { 32 , 64 }
CNN-LSTMCNN filters { 16 , 32 }
CNN kernel size { 3 , 5 }
LSTM hidden units { 32 , 64 }
LSTM layers1
Dropout rate { 0.1 , 0.2 }
Learning rate { 10 3 , 5 × 10 4 }
Batch size { 32 , 64 }
Transformer and InformerEmbedding dimension d model { 32 , 64 }
Number of attention heads2
Encoder layers { 1 , 2 }
Dropout rate { 0.1 , 0.2 }
Learning rate { 10 3 , 5 × 10 4 }
Batch size { 32 , 64 }
PatchTSTEmbedding dimension d model { 32 , 64 }
Number of attention heads2
Encoder layers { 1 , 2 }
Patch length { 4 , 8 }
Patch stride2
Dropout rate { 0.1 , 0.2 }
Learning rate { 10 3 , 5 × 10 4 }
Batch size { 32 , 64 }
Proposed frameworkCNN filters { 16 , 32 }
CNN kernel size { 3 , 5 }
LSTM hidden units { 32 , 64 }
LSTM layers1
Dropout rate { 0.1 , 0.2 }
Learning rate { 10 3 , 5 × 10 4 }
Batch size { 32 , 64 }
Training protocolMaximum epochs80
Early stopping patience12 epochs
Weight decay 10 5
Gradient clipping 1.0
Table 5. Selected hyperparameter configurations obtained from the nested blocked validation procedure. Values in parentheses are ordered as ( F 1 , F 2 , F 3 ) across the three outer folds.
Table 5. Selected hyperparameter configurations obtained from the nested blocked validation procedure. Values in parentheses are ordered as ( F 1 , F 2 , F 3 ) across the three outer folds.
Model h = 1 h = 5 h = 10
Random Forest–ARX L = ( 50 , 30 , 30 ) ;
N t = ( 300 , 200 , 250 ) ;
depth  = ( 10 , 20 , None ) ;
leaf  = ( 1 , 5 , 5 )
L = ( 10 , 50 , 10 ) ;
N t = ( 200 , 300 , 200 ) ;
depth  = ( None , 10 , None ) ;
leaf  = ( 3 , 1 , 3 )
L = ( 10 , 30 , 50 ) ;
N t = ( 250 , 250 , 300 ) ;
depth  = ( 20 , 10 , 10 ) ;
leaf  = ( 1 , 3 , 1 )
Extra Trees–ARX L = ( 10 , 50 , 30 ) ;
N t = ( 250 , 300 , 250 ) ;
depth  = ( 20 , 10 , None ) ;
leaf  = ( 1 , 1 , 5 )
L = ( 30 , 30 , 30 ) ;
N t = ( 250 , 250 , 250 ) ;
depth  = ( None , 10 , None ) ;
leaf  = ( 5 , 3 , 5 )
L = ( 10 , 50 , 30 ) ;
N t = ( 250 , 300 , 200 ) ;
depth  = ( None , 10 , 10 ) ;
leaf  = ( 1 , 1 , 5 )
HistGB–ARX L = ( 20 , 10 , 20 ) ;
η = ( 0.08 , 0.08 , 0.03 ) ;
leaves  = ( 15 , 31 , 15 ) ;
iter  = ( 200 , 200 , 200 )
L = ( 20 , 20 , 20 ) ;
η = ( 0.03 , 0.03 , 0.03 ) ;
leaves  = ( 15 , 15 , 15 ) ;
iter  = ( 400 , 200 , 200 )
L = ( 10 , 20 , 20 ) ;
η = ( 0.05 , 0.03 , 0.03 ) ;
leaves  = ( 15 , 15 , 15 ) ;
iter  = ( 300 , 200 , 200 )
LSTM L = ( 30 , 20 , 20 ) ; d = ( 64 , 64 , 64 ) ;
drop  = ( 0.2 , 0.1 , 0.1 ) ;
lr  = ( 10 3 , 10 3 , 10 3 ) ;
bs  = ( 64 , 64 , 64 )
L = ( 10 , 30 , 20 ) ; d = ( 32 , 64 , 32 ) ;
drop  = ( 0.2 , 0.2 , 0.2 ) ;
lr  = ( 5 × 10 4 , 10 3 , 5 × 10 4 ) ;
bs  = ( 64 , 64 , 32 )
L = ( 20 , 10 , 10 ) ; d = ( 32 , 32 , 32 ) ;
drop  = ( 0.2 , 0.2 , 0.2 ) ;
lr  = ( 5 × 10 4 , 5 × 10 4 , 5 × 10 4 ) ;
bs  = ( 32 , 64 , 64 )
CNN–LSTM L = ( 20 , 50 , 10 ) ; q = ( 32 , 32 , 16 ) ;
κ = ( 5 , 3 , 3 ) ; d = ( 64 , 64 , 64 ) ;
drop  = ( 0.1 , 0.1 , 0.2 ) ;
lr  = ( 10 3 , 5 × 10 4 , 5 × 10 4 ) ;
bs  = ( 64 , 32 , 64 )
L = ( 10 , 10 , 10 ) ; q = ( 16 , 16 , 16 ) ;
κ = ( 5 , 5 , 5 ) ; d = ( 32 , 32 , 32 ) ;
drop  = ( 0.1 , 0.1 , 0.1 ) ;
lr  = ( 10 3 , 10 3 , 10 3 ) ;
bs  = ( 64 , 64 , 64 )
L = ( 50 , 20 , 10 ) ; q = ( 32 , 32 , 16 ) ;
κ = ( 3 , 5 , 3 ) ; d = ( 64 , 64 , 64 ) ;
drop  = ( 0.1 , 0.1 , 0.2 ) ;
lr  = ( 5 × 10 4 , 10 3 , 5 × 10 4 ) ;
bs  = ( 32 , 64 , 64 )
Transformer L = ( 10 , 50 , 20 ) ; d m = ( 32 , 64 , 32 ) ;
heads  = ( 2 , 2 , 2 ) ;
layers  = ( 2 , 2 , 2 ) ;
drop  = ( 0.1 , 0.1 , 0.2 ) ;
lr  = ( 10 3 , 5 × 10 4 , 5 × 10 4 ) ;
bs  = ( 64 , 32 , 64 )
L = ( 10 , 10 , 20 ) ; d m = ( 64 , 32 , 64 ) ;
heads  = ( 4 , 2 , 2 ) ;
layers  = ( 2 , 1 , 1 ) ;
drop  = ( 0.2 , 0.2 , 0.2 ) ;
lr  = ( 10 3 , 10 3 , 5 × 10 4 ) ;
bs  = ( 32 , 64 , 64 )
L = ( 50 , 20 , 10 ) ; d m = ( 64 , 64 , 64 ) ;
heads  = ( 2 , 2 , 4 ) ;
layers  = ( 2 , 1 , 2 ) ;
drop  = ( 0.1 , 0.2 , 0.2 ) ;
lr  = ( 5 × 10 4 , 5 × 10 4 , 10 3 ) ;
bs  = ( 32 , 64 , 32 )
Informer L = ( 10 , 10 , 20 ) ; d m = ( 32 , 32 , 32 ) ;
heads  = ( 2 , 2 , 2 ) ;
layers  = ( 2 , 1 , 2 ) ;
drop  = ( 0.1 , 0.2 , 0.2 ) ;
lr  = ( 10 3 , 10 3 , 5 × 10 4 ) ;
bs  = ( 64 , 64 , 64 )
L = ( 50 , 20 , 10 ) ; d m = ( 64 , 64 , 32 ) ;
heads  = ( 2 , 2 , 2 ) ;
layers  = ( 2 , 1 , 1 ) ;
drop  = ( 0.1 , 0.2 , 0.2 ) ;
lr  = ( 5 × 10 4 , 5 × 10 4 , 10 3 ) ;
bs  = ( 32 , 64 , 64 )
L = ( 20 , 20 , 10 ) ; d m = ( 32 , 32 , 32 ) ;
heads  = ( 2 , 2 , 2 ) ;
layers  = ( 2 , 2 , 1 ) ;
drop  = ( 0.2 , 0.2 , 0.2 ) ;
lr  = ( 5 × 10 4 , 5 × 10 4 , 10 3 ) ;
bs  = ( 64 , 64 , 64 )
PatchTST L = ( 10 , 10 , 10 ) ; d m = ( 64 , 32 , 64 ) ;
heads  = ( 2 , 2 , 2 ) ;
layers  = ( 2 , 1 , 2 ) ;
patch  = ( 4 , 8 , 4 ) ; stride  = ( 2 , 2 , 2 ) ;
lr  = ( 5 × 10 4 , 10 3 , 5 × 10 4 ) ;
bs  = ( 32 , 32 , 32 )
L = ( 10 , 10 , 10 ) ; d m = ( 64 , 32 , 32 ) ;
heads  = ( 2 , 2 , 2 ) ;
layers  = ( 2 , 1 , 1 ) ;
patch  = ( 4 , 8 , 8 ) ; stride  = ( 2 , 2 , 2 ) ;
lr  = ( 5 × 10 4 , 10 3 , 10 3 ) ;
bs  = ( 32 , 32 , 32 )
L = ( 10 , 10 , 10 ) ; d m = ( 32 , 64 , 64 ) ;
heads  = ( 2 , 2 , 2 ) ;
layers  = ( 1 , 2 , 2 ) ;
patch  = ( 8 , 4 , 4 ) ; stride  = ( 2 , 2 , 2 ) ;
lr  = ( 10 3 , 5 × 10 4 , 5 × 10 4 ) ;
bs  = ( 32 , 32 , 32 )
Proposed L = ( 20 , 10 , 20 ) ; q = ( 32 , 16 , 32 ) ;
κ = ( 5 , 5 , 5 ) ; d = ( 64 , 32 , 64 ) ;
drop  = ( 0.1 , 0.1 , 0.1 ) ;
lr  = ( 10 3 , 10 3 , 10 3 ) ;
bs  = ( 64 , 64 , 64 )
L = ( 10 , 20 , 50 ) ; q = ( 16 , 32 , 32 ) ;
κ = ( 5 , 5 , 3 ) ; d = ( 32 , 32 , 64 ) ;
drop  = ( 0.1 , 0.1 , 0.1 ) ;
lr  = ( 10 3 , 5 × 10 4 , 5 × 10 4 ) ;
bs  = ( 64 , 64 , 32 )
L = ( 20 , 20 , 20 ) ; q = ( 32 , 32 , 32 ) ;
κ = ( 5 , 5 , 5 ) ; d = ( 64 , 32 , 64 ) ;
drop  = ( 0.1 , 0.1 , 0.1 ) ;
lr  = ( 10 3 , 5 × 10 4 , 10 3 ) ;
bs  = ( 64 , 64 , 64 )
L: historical window length; Nt: number of trees; depth: maximum tree depth; leaf: minimum samples per leaf; η: HistGB learning rate; iter: maximum boosting iterations; q: number of convolution filters; κ: convolution kernel size; d: LSTM hidden dimension; dm: Transformer embedding dimension; heads: number of attention heads; bs: batch size; lr: learning rate.
Table 6. Mean ± standard deviation of predictive performance across the three outer folds. The best value for each metric and horizon is shown in bold, and the second-best value is underlined. For MBD, ranking is based on absolute magnitude.
Table 6. Mean ± standard deviation of predictive performance across the three outer folds. The best value for each metric and horizon is shown in bold, and the second-best value is underlined. For MBD, ranking is based on absolute magnitude.
HorizonModelMAERMSE R 2 sMAPE (%)MedAEEVMBDr
h = 1 Proposed 0 . 0038 ± 0 . 0006 0 . 0096 ± 0 . 0020 0 . 9662 ± 0 . 0037 4 . 87 ± 1 . 63 0 . 0013 ± 0 . 0003 0 . 9664 ± 0 . 0036 0.0005 ± 0.0006 0 . 9832 ± 0 . 0017
LSTM 0.0052 ± 0.0008 0.0110 ± 0.0017 0.9550 ± 0.0040 7.14 ± 2.55 0.0030 ± 0.0005 0.9553 ± 0.0044 0.0006 ± 0.0012 0.9805 ± 0.0029
CNN–LSTM 0.0055 ± 0.0012 0.0116 ± 0.0026 0.9498 ± 0.0102 7.36 ± 2.64 0.0028 ± 0.0006 0.9506 ± 0.0089 0.0006 ± 0.0018 0.9770 ± 0.0020
PatchTST 0.0062 ± 0.0014 0.0143 ± 0.0051 0.9250 ± 0.0303 8.14 ± 1.75 0.0036 ± 0.0010 0.9278 ± 0.0333 0.0013 ± 0.0025 0.9696 ± 0.0127
Transformer 0.0061 ± 0.0011 0.0156 ± 0.0032 0.9101 ± 0.0046 7.51 ± 2.00 0.0029 ± 0.0008 0.9105 ± 0.0043 0.0009 ± 0.0007 0.9607 ± 0.0082
Random Forest–ARX 0.0059 ± 0.0017 0.0157 ± 0.0058 0.9111 ± 0.0335 7.61 ± 2.30 0.0017 ± 0.0004 0.9128 ± 0.0311 0.0018 ± 0.0023 0.9573 ± 0.0137
Naive persistence 0.0055 ± 0.0013 0.0159 ± 0.0052 0.9075 ± 0.0356 6.38 ± 2.07 0.0017 ± 0.0003 0.9075 ± 0.0356 0 . 0000 ± 0 . 0000 0.9537 ± 0.0178
Informer 0.0082 ± 0.0005 0.0185 ± 0.0059 0.8756 ± 0.0352 9.95 ± 1.61 0.0047 ± 0.0010 0.8848 ± 0.0467 0.0033 ± 0.0030 0.9488 ± 0.0253
Extra Trees–ARX 0.0078 ± 0.0053 0.0195 ± 0.0099 0.8598 ± 0.0977 9.81 ± 6.13 0.0021 ± 0.0017 0.8702 ± 0.0805 0.0034 ± 0.0062 0.9380 ± 0.0445
HistGB–ARX 0.0115 ± 0.0103 0.0225 ± 0.0151 0.8010 ± 0.1997 13.33 ± 10.49 0.0080 ± 0.0100 0.8363 ± 0.1393 0.0061 ± 0.0117 0.9275 ± 0.0603
h = 5 Proposed 0 . 0196 ± 0 . 0035 0 . 0436 ± 0 . 0097 0 . 2980 ± 0 . 1171 22 . 76 ± 5 . 99 0.0099 ± 0.0015 0 . 3014 ± 0 . 1113 0.0018 ± 0.0032 0.5598 ± 0.0852
PatchTST 0.0230 ± 0.0014 0.0456 ± 0.0069 0.2219 ± 0.0868 27.35 ± 3.39 0.0134 ± 0.0017 0.2304 ± 0.0991 0.0030 ± 0.0055 0.4849 ± 0.0959
Naive persistence 0.0209 ± 0.0043 0.0485 ± 0.0127 0.1323 ± 0.2396 23.01 ± 6.44 0 . 0084 ± 0 . 0015 0.1323 ± 0.2396 0 . 0000 ± 0 . 0002 0 . 5663 ± 0 . 1195
LSTM 0.0298 ± 0.0173 0.0496 ± 0.0165 0.1071 ± 0.2860 32.81 ± 15.05 0.0221 ± 0.0190 0.2520 ± 0.0718 0.0118 ± 0.0241 0.5266 ± 0.0725
CNN–LSTM 0.0348 ± 0.0256 0.0621 ± 0.0350 0.4616 ± 1.1887 33.74 ± 16.85 0.0184 ± 0.0144 0.1409 ± 0.6911 0.0132 ± 0.0382 0.4953 ± 0.0959
Transformer 0.0431 ± 0.0403 0.0654 ± 0.0428 0.6748 ± 1.6398 39.15 ± 25.99 0.0291 ± 0.0319 0.0257 ± 0.5327 0.0253 ± 0.0507 0.4996 ± 0.1079
Extra Trees–ARX 0.0437 ± 0.0406 0.0699 ± 0.0517 0.9971 ± 2.2380 38.97 ± 23.94 0.0331 ± 0.0380 0.3480 ± 1.1149 0.0275 ± 0.0491 0.4766 ± 0.1623
Informer 0.0434 ± 0.0395 0.0707 ± 0.0511 1.0253 ± 2.2149 38.09 ± 21.79 0.0229 ± 0.0204 0.4101 ± 1.1824 0.0232 ± 0.0504 0.4795 ± 0.1327
Random Forest–ARX 0.0411 ± 0.0332 0.0709 ± 0.0497 1.0020 ± 2.1149 36.92 ± 20.27 0.0280 ± 0.0292 0.5713 ± 1.3834 0.0242 ± 0.0383 0.4194 ± 0.1853
HistGB–ARX 0.0533 ± 0.0563 0.0836 ± 0.0743 2.0964 ± 4.1098 42.24 ± 28.83 0.0466 ± 0.0610 0.9361 ± 2.1015 0.0367 ± 0.0657 0.4376 ± 0.1746
h = 10 PatchTST 0 . 0284 ± 0 . 0059 0 . 0521 ± 0 . 0112 0.0009 ± 0.0787 33.17 ± 6.75 0.0173 ± 0.0025 0.0147 ± 0.0696 0.0003 ± 0.0077 0.1959 ± 0.0905
Proposed 0.0291 ± 0.0096 0.0521 ± 0.0138 0 . 0098 ± 0 . 1675 33.31 ± 9.38 0.0181 ± 0.0065 0 . 0447 ± 0 . 1236 0.0028 ± 0.0131 0.3176 ± 0.0584
Transformer 0.0317 ± 0.0143 0.0552 ± 0.0187 0.1092 ± 0.3846 34.59 ± 10.87 0.0196 ± 0.0097 0.0142 ± 0.2455 0.0066 ± 0.0210 0 . 3279 ± 0 . 0610
Naive persistence 0.0291 ± 0.0048 0.0604 ± 0.0102 0.3684 ± 0.2179 32 . 28 ± 8 . 36 0 . 0145 ± 0 . 0025 0.3684 ± 0.2178 0 . 0000 ± 0 . 0005 0.3153 ± 0.1083
Extra Trees–ARX 0.0482 ± 0.0402 0.0690 ± 0.0420 0.8396 ± 1.6552 45.04 ± 24.45 0.0447 ± 0.0483 0.2080 ± 0.5625 0.0273 ± 0.0483 0.2903 ± 0.1037
Informer 0.0501 ± 0.0449 0.0759 ± 0.0517 1.2956 ± 2.3535 43.93 ± 24.68 0.0374 ± 0.0399 0.6023 ± 1.1650 0.0262 ± 0.0524 0.2156 ± 0.1058
Random Forest–ARX 0.0446 ± 0.0324 0.0780 ± 0.0530 1.4035 ± 2.4570 40.96 ± 18.11 0.0302 ± 0.0246 0.9587 ± 1.6903 0.0234 ± 0.0401 0.2238 ± 0.1642
HistGB–ARX 0.0476 ± 0.0391 0.0805 ± 0.0605 1.6644 ± 3.0321 42.50 ± 20.89 0.0359 ± 0.0342 1.0627 ± 1.9901 0.0267 ± 0.0470 0.2600 ± 0.0753
CNN–LSTM 0.0385 ± 0.0241 0.0815 ± 0.0625 1.7483 ± 3.1947 35.30 ± 10.63 0.0185 ± 0.0050 1.5116 ± 2.8185 0.0135 ± 0.0317 0.2821 ± 0.1104
LSTM 0.0691 ± 0.0782 0.0994 ± 0.0946 3.5589 ± 6.3738 49.30 ± 33.96 0.0494 ± 0.0602 1.4189 ± 2.6910 0.0481 ± 0.0905 0.3041 ± 0.1476
Table 7. Computational complexity and runtime characteristics of the evaluated forecasting models. Values are averaged over the three outer folds.
Table 7. Computational complexity and runtime characteristics of the evaluated forecasting models. Values are averaged over the three outer folds.
HorizonModelParameters/
Trees–Nodes
Training Time (s)Inference (ms/Sample)Throughput (Samples/s)Model Size (MB)
h = 1 Naive persistence00.000.0000 8.16 × 10 7 0.000
Random Forest–ARX250/293,67843.980.043024,71020.227
Extra Trees–ARX267/722,0585.560.044322,68349.646
HistGB–ARX1.780.0090113,8710.650
LSTM22,65717.430.027636,5820.089
CNN–LSTM28,58242.340.025040,5260.112
Transformer52,78035.830.027036,9930.294
Informer18,72129.740.026937,2370.143
PatchTST75,94860.050.025040,1290.300
Proposed51,07334.880.027936,0450.200
h = 5 Naive persistence00.000.0000 7.89 × 10 7 0.000
Random Forest–ARX233/366,96749.420.065416,25425.255
Extra Trees–ARX250/393,9897.030.047621,06327.114
HistGB–ARX2.540.014882,2910.687
LSTM11,69210.660.024641,2930.047
CNN–LSTM79857.940.029234,7020.034
Transformer57,87829.180.029934,2040.331
Informer49,24919.820.036428,0090.299
PatchTST45,71825.700.024740,7320.183
Proposed35,7133.690.029634,6300.142
h = 10 Naive persistence00.000.0000 6.81 × 10 7 0.000
Random Forest–ARX267/248,07948.030.046621,49417.099
Extra Trees–ARX250/964,3115.690.045322,37766.276
HistGB–ARX1.950.011795,4820.591
LSTM620911.440.025040,6060.026
CNN–LSTM28,5825.690.023243,6380.112
Transformer88,10810.590.024741,0610.468
Informer18,72117.730.026038,6900.143
PatchTST75,94820.580.031134,2970.300
Proposed52,6099.130.034329,9210.206
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Alghamdi, M.M. A Residual Exogenous–Autoregressive Gated Forecasting Framework for Nonlinear Dynamic Time Series: Application to Hydrogen Sulfide Prediction. Mathematics 2026, 14, 2878. https://doi.org/10.3390/math14162878

AMA Style

Alghamdi MM. A Residual Exogenous–Autoregressive Gated Forecasting Framework for Nonlinear Dynamic Time Series: Application to Hydrogen Sulfide Prediction. Mathematics. 2026; 14(16):2878. https://doi.org/10.3390/math14162878

Chicago/Turabian Style

Alghamdi, Maha Mesfer. 2026. "A Residual Exogenous–Autoregressive Gated Forecasting Framework for Nonlinear Dynamic Time Series: Application to Hydrogen Sulfide Prediction" Mathematics 14, no. 16: 2878. https://doi.org/10.3390/math14162878

APA Style

Alghamdi, M. M. (2026). A Residual Exogenous–Autoregressive Gated Forecasting Framework for Nonlinear Dynamic Time Series: Application to Hydrogen Sulfide Prediction. Mathematics, 14(16), 2878. https://doi.org/10.3390/math14162878

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop