1. Introduction
A large number of extra-long tunnels have emerged as China’s infrastructure construction gradually covers remote mountainous areas as well as the western plateau zone. Meanwhile, due to the narrow, long, and closed characteristics of the tunnels themselves, it is inevitable that the coal strata need to be crossed during the tunnel construction process, which leads to a large influx of coal seam gas into the tunnel interior [
1,
2]. On the one hand, high gas concentrations can easily ignite, resulting in a fire at the working face or a gas explosion that could result in a lot of victims. On the other hand, tunnel face building can also result in coal (rock) and gas explosions, which destroy and obstruct the tunnel’s interior area and result in asphyxiation [
3]. Consequently, it is of great practical importance to adopt accurate and reliable gas prevention and control methods in the process of tunnel construction safety, as well as green energy saving and efficient production, in order to reduce the number of casualties and property damage caused by gas disaster accidents.
The prediction of gas concentration has been an important tool for preventing and controlling the occurrence of gas disasters, and has been widely used in the field of coal mine gas prediction. The comprehensive influence of gas concentrations on existing coal seam gas conditions, the coal mining method, the roadway boring process and other factors [
4], and the complex and dynamic nonlinear relationship among the factors [
5] make it difficult for general linear prediction methods to meet the prediction accuracy requirements [
6]. There are essential differences between coal penetration tunnels and coal mine roadway boring processes based on the characteristics of coal seam gas gushing and the characteristics of the tunnels themselves. As a result, both domestic and international researchers have put forth numerous efficient nonlinear prediction methods by combining the necessary machine learning algorithms, such as gray theory [
7,
8], support vector machine [
9], random forest [
10], and the artificial neural network [
11,
12]. Although the majority of gas tunnels can provide gas monitoring data, they rarely identify all relevant factors affecting gas concentration and the corresponding complete data, which causes nonlinear models based on multiple factors to diverge from reality [
13].
Despite this, these approaches are still able to capture data from nonlinear mapping relationships and learn from trends. Due to this, domestic and international researchers have attempted to start from the gas time series itself and use prediction methods such as the autoregressive sliding average (ARMA), support vector machine (SVM), Bayesian network (BN), and matrix decomposition (MF) to mine the series′ effective information in order to achieve the prediction of future information [
14,
15]. The advantage is that it makes full use of the raw gas monitoring data collected by the field monitoring system and does not require the effort of determining the causal relationships between the factor variables, but simply extrapolates the historical trends identified by the time series model to predict future trends. Furthermore, given that time series impacted by gas concentrations are taken into account, recurrent neural networks (RNNs) have strong processing power when learning nonlinear aspects of sequences, but they also experience issues such gradient disappearance or loss of historical data [
16]. The long short-term memory network (LSTM) is a superb RNN version that has the ability to handle problems that are highly associated with time series and effectively overcome the limitations of RNN in dealing with serial data and automatically mining probable data correlations [
17].
The LSTM network model has been used in the prediction of gas concentration in tunnels, mainly to build a single-step prediction model for gas concentrations at a particular step in the future, achieving high prediction accuracy [
18,
19]. However, in the field process construction, the current moment gas concentration may depend on the change pattern of several historical samples for a long time, and the single-step iterative training mode is difficult to capture the temporal characteristics efficiently, which makes the single-step prediction results neither intuitively portray the trend of gas concentration changes in the future period nor provide a reliable reference basis for the field construction. At the same time, multi-step prediction models have been applied more often in wind speed prediction, traffic flow prediction, and stock prediction, while very few studies have been applied in gas tunnels [
20,
21]. However, the multi-step prediction results can help to both prevent and regulate the incidence of gas incidents and offer a definite reference foundation for process operations and site ventilation efficiency.
Based on the potential disaster risks of gas combustion, explosion, and coal and gas outbursts in coal penetration tunnel construction, a novel stepwise prediction method based on the LSTM network prediction model was proposed in this paper for gas disaster prevention. Single-step and multi-step prediction models were established by the method to consider the effects of the input step length, output step length, and interval step length on the prediction performance of the model. The optimal combination of parameters was determined to achieve a stepwise prediction of the short-term gas concentration trend for each construction process at the excavation workface. For the sustainable growth of tunnel ventilation in terms of energy conservation, effective production, and construction safety, the theoretical foundation and assistance can be offered.
2. Prediction Model Building
2.1. LSTM Network Theory
The long short-term memory (LSTM) network [
22,
23] is a special type of recurrent neural network. When processing time series data, it can obtain changes by adding input gates, forget gates, and output gates. In addition, the LSTM network can more accurately characterize the sequence data with spatial and temporal correlations, and realize the efficient use of historical data when the model parameters are fixed. This prevents the problem of gradient explosion and disappearance of RNN. The LSTM’s structure is depicted in
Figure 1 below.
Each of the aforementioned three gate architectures gradually updates the cell state, as shown by the LSTM structural diagram. In the first step, the forget gate determines the information discarded from the cell state
in the previous moment. In the second step, the information that needs to be updated in the old cell state is determined by the input gate, and the generation of alternative information
for updating by the tanh layer to determine how much new information needs to be allowed to be added to the cell state. In the third step, the two steps in the second step are combined to update, and a new cell state is obtained
. Finally, the σ output gate filters and scales from the new cell state to obtain the output information
of the hidden layer [
18]. The specific algorithm is as follows [
17].
Output state:
where
,
, and
are the outputs of the forget gate, input gate, and output gate at time
t, respectively;
,
, and
and
,
,and
are the weight matrix and bias of the neural unit forgetting gate, input gate, output gate, and unit information update, respectively;
σ is the sigmoid activation function; and tanh is the tangent activation function of hyperbolas.
2.2. Model Construction Ideas
The steps for predicting short-term gas concentrations at the tunnel palm face are as follows:
Step 1: Data source: Extraction of gas data from the database based on online monitoring data from field sensors;
Step 2: Data processing: Pre-processing of missing data values and outliers to obtain sample datasets;
Step 3: Model comparison: Building a gas prediction model based on multiple intelligent computational methods and testing the model errors and comparing them by the stepwise trial and error method to select the best training model for the dataset;
Step 4: Stepwise prediction: Using a combination of single-step and multi-step stepwise prediction means, the extrapolation performance of the model is studied using a rolling prediction method, using a grid search to determine the hyperparameters, while considering the effect of different input steps and interval steps on the model performance, to determine the optimal combination of parameters for stepwise prediction, and finally to achieve the short-term prediction of gas concentrations at a future moment or time period.
2.3. Dataset Preprocessing
In order to prevent the problems of excessive model prediction error and overfitting due to insufficient sample size in model training, this paper refers to the four-step method of the sample size calculation [
24], and the minimum sample size was estimated to be about 600 h based on certain empirical parameters. In selecting the sample size of the data, the gas concentration data were taken from the real-time air exhaust gas concentrations collected by the tunnel automatic monitoring system crossing the same coal seam working face, with a sampling time of 30 d in April 2022 and a time node of a 1 h equidistant interval, for a total of 720 > 600 h.
As gas monitoring data are affected by a number of factors such as process cycle operations, i.e., construction process cycle operation, fan capacity adjustment, and sensor interference or failure, there are often missing values and abnormal values. If they are removed, this will not only destroy the time series and data stability of the data themselves, but also lead to low accuracy of model prediction due to the lack of data samples.
Therefore, the average value is used to correct the abnormal value that is the average value of the first, and the last non-abnormal values is used to replace the abnormal value [
25], so as to reduce the influence of data anomalies on the performance of the prediction model. In addition, if the data sample itself does not have many missing values, the number of the original gas sequences and the number of the missing values are determined and the missing values are filled in using cubic spline interpolation [
26]. The dataset was divided according to the following proportion: 70% was used as a training set for network training, and 30% as a test set for out-of-sample prediction, namely 504 training sets and 216 test sets, as shown in
Figure 2.
Aiming at the time series prediction requires a certain sequence length of data input. The innovation of the model prediction method was that the training set was transformed into multiple training sub-samples of n groups of m-dimensional vectors by using a sliding window with a step length of 1 h, and then the rolling prediction was realized by using the previous output results as the input data [
27,
28]; where m = input step + output step, the input step is the sub-length of the training data sequence, and the output step is the predicted sequence length. The prediction of gas concentration with different steps can be completed by inputting different steps, i.e., the prediction performance of the model with different steps can be studied by updating the input value through continuous sliding prediction by rolling prediction. Step = 1 is single-step prediction; step ≥ 2 is multi-step prediction. The rolling prediction diagram is shown in
Figure 3.
The single step mentioned in this paper represents an hour: 24 h a day is 24 steps. The sample set of 30 days resulted in a total of 720 steps, corresponding to the horizontal coordinates of the original data sample shown in
Figure 2. Single-step prediction, also known as one-dimensional one-step prediction, is based on one-dimensional time series, using the previous steps (previous hours) as the input variable interval n steps (interval several hours) to predict the average gas concentration of a future step (a certain hour). Multi-step prediction is also called single-dimensional multi-step prediction, which means that the average gas concentration of a certain step in the future is predicted by using the previous steps as the input variables and interval n steps, where interval 0 steps are multi-step continuous prediction.
2.4. Model Parameter Settings
Super-parameter selection can significantly increase the LSTM network model’s predictive accuracy [
27], the number of input, output, and interval steps in a batch of training, the random inactivation rate (dropout), the number of training sessions (epoch), the number of layers (L) of the LSTM hidden layer, and the number of hidden layer neurons (rnn unit). The interval between the projected value and the actual value is represented by the interval step. Some super-parameters were trained using the grid search approach to guarantee the accuracy of gas predictions. Stepwise prediction was accomplished using the data sliding window in the code, as shown in
Table 1 below.
The LSTM prediction model is composed of a single hidden layer and a dense full connection layer, and the dropout layer is set up in the LSTM layer to prevent overfitting. The batch size was set to 1, MSE was utilized as the loss function, and the learning rate was set to lr = 0.001 in order to maximize the suggested model structure. The samples were trained using the Adam optimizer. To reduce the discrepancy between the predicted value and the actual value, the connection weights within the network were changed after each iteration.
2.5. Model Evaluation Indicators
Relative error (δ), mean absolute error (MAE), coefficient of determination (R
2), and root mean square error (RMSE) were employed as evaluation indicators in order to objectively assess the model’s suitability [
19]. The accuracy of the prediction outcomes was inversely correlated with the values of, MAE, and RMSE; the smaller the value, the better the accuracy. The more closely the R
2 number approached 1, the more accurate the forecast. The following were the ways for calculating errors:
where
represents the
i-th predicted value,
yi represents the
i-th real value,
represents the average value of the real data, and
n represents the number of predicted points.
3. Result and Discussion
A tunnel with a total length of 6044 m is located in an alpine and high-altitude area. According to the advanced geological prediction, the tunnel under construction crosses a coal stratum, and when the advance geological borehole was being constructed at the ZK37+845 palm face of the left tunnel, the gas concentration was detected as high as 2.5% in the left- and right-side boreholes 2 m from the bottom plate. The geological structure of coal measures would be destroyed during tunnel excavation, and a huge quantity of dangerous gases would be produced readily, according to on-site monitoring and analysis. Gas, a small amount of hydrogen sulfide, and carbon monoxide are the principal hazardous gases.
As known from the engineering geology report, the tunnel follows the left and right holes and has coal strata that are at least 1400 m long. Using the aforementioned engineering background as a foundation, this paper employed a variety of intelligent calculation techniques to create prediction models, train the samples to choose the best model, and then make stepwise predictions of the gas concentration at the palm face based on this model.
3.1. Model Comparison
Multiple intelligent algorithms, including the regression vector machine (SVR), multi-layer perceptron (MLP), gated loop unit (GRU), and long short-term memory network (LSTM), were used to construct prediction models for comparison in order to choose the best prediction model for the sample. The preprocessed data were used as the sample dataset in this study, and the relative error (δ), average absolute error (MAE), decisive coefficient (R
2), and root mean square error (RMSE) were used as the evaluation indices. To compare the performance of the four prediction models, the minimum evaluation index of the model was chosen. According to the test set, various models′ test sample prediction curves were drawn, as seen in
Figure 4.
Zoomed in on a total of 48 data points from the two days after the test sample,
Figure 4a demonstrates that the four prediction models fit in a descending order from LSTM > GRU > MLP > SVR at the crest, trough, extreme value point, and inflection point. The relative errors of SVR and MLP are within 12% and 8%, respectively, as can be shown from
Figure 4b. The fluctuation range is wide and the accuracy is low when compared to the other two single prediction models. GRU was within ± 6%, with high accuracy. Nonetheless, LSTM was largely maintained at 3%. The prediction performance at the extreme point was better and the overall error was reduced by two times when compared to GRU, showing that the model was better able to capture the correlation between historical monitoring information.
In order to objectively investigate the performance indices and further assess the model’s predictive accuracy, the MAE, RMSE, and R2 values of the four prediction models were extracted. According to
Table 2, the LSTM network model had a fitting degree R2 of about 0.94, and the MAE and RMSE values were the smallest among the three prediction models, which provided it a greater prediction accuracy and better generalization ability on the test set. Therefore, the preferred LSTM network prediction model was used as the optimal prediction model for this sample to provide some basic support for the subsequent stepwise prediction of gas.
3.2. Analysis of Single-Step Prediction Results
3.2.1. Different Input Time Steps
As can be seen from the model parameter settings, the predictive performance of the model was determined by a number of hyperparameters together, the most important of which was the determination of the input step for the rolling prediction subsamples [
20]. When determining the input step length, it was difficult to capture the long-term dependence of the sample if the step length was too short, and if it was too long it could result in redundant information and reduced learning efficiency [
21]. It was therefore important to use a suitable input step length for the prediction of gas concentration trends in order to better suit the prediction needs of the various operational processes in the actual project and to reduce the complexity of the training model. Considering that the duration of each construction process was 2~4 h, the data themselves had the characteristics of randomness, periodicity, volatility, and mutation. In this paper, firstly, based on the preferred LSTM network prediction model, the complete period of single or multiple process change trends was used as the input step length, and the actual capacity of the dataset was combined to set the input step between 1 and 10. Then, considering the influence of the interval step, the single-step prediction model was established by selecting the step length with less loss and error. Three evaluation indexes were used to evaluate the prediction effect of the model under different output step lengths as shown in
Figure 5.
The model’s predictive performance was influenced by a variety of hyperparameters, the most significant of which was the choice of the input step for the rolling prediction subsamples, as can be seen from the model parameter settings [
20]. A little step length made it impossible to capture the sample’s long-term reliance, while a big step length might lead to redundant information and decreased learning effectiveness [
21]. Therefore, it was important to use appropriate input steps for predicting gas concentration trends in order to better suit the prediction needs of each work process in the actual project and to reduce the complexity of the training model. Considering that the duration of each construction process on site was 2–4 h, this made the data inherently random, periodic, fluctuating, and mutable. In order to better meet the prediction requirements of each work process in the actual project and to lessen the complexity of the training model, it was critical to select the appropriate input step length for predicting gas concentration trends. The data were intrinsically random, periodic, variable, and mutable because each construction process on site lasted between two and four hours.
As seen in
Figure 5, when the input step length was 2~8, the model had a better prediction effect under the evaluation index in 3, which also verified that neither the larger the input step length nor the smaller the input step length resulted in the highest prediction accuracy. However, the difference between the MAE and RMSE evaluation index values under different output step lengths was not significant at time t+1. From the curve fitting degree determination coefficient R
2, when the input step lengths were 2, 4, and 6, the gas prediction data in the past 2, 4, and 6 h could make the model result in the best prediction effect.
3.2.2. Analysis of the Effect of Single-Step Prediction
To find out how the interval step affects the accuracy of the gas concentration prediction at a later time, the best time steps for the single-step predictions obtained above were compared and examined. The single-step prediction effect exhibited a discernible decreasing trend with an increase in the interval step, as shown in
Figure 6a,c,e from the peak, trough, extreme point, and inflection point of the curve. The relative error of the forecast findings, however, can more accurately and intuitively convey the veracity of the prediction effect. The relative inaccuracy of the single-step prediction effect also tended to diminish to varying degrees as the interval step length was decreased, as shown in
Figure 6b,d,f. Meanwhile, the relative error of interval 0 step (interval 0) varied at 5% with excellent accuracy, that of interval 1 step (interval 1) was roughly two to five times bigger, and that of the prediction effect of interval 2 step (interval 2) was considerably higher.
The three evaluation indices typically exhibited a phenomenon of continuous deterioration with the increase in the interval step, which results in poor accuracy and reliability of prediction, as can be seen from
Table 3. On the other hand, when the input step length was moderate, the prediction effect of the model was better. When the anticipated value for the following 1 h was 0.3337%, the curve fit R
2 value was as high as 0.94 and the MAE and RMSE values were likewise relatively minimum. Although there was only a 0.80 and 0.60 accuracy in predicting the gas value at times t+2 and t+3, in the future, accurate, efficient, convenient, and synchronous gas rapid prediction technology can not only realize synchronous monitoring and prevention with the automatic monitoring system on the spot, but also serve as a guide for the following construction process.
3.3. Analysis of Multi-Step Prediction Results
In order to study the change trends of gas concentrations in a certain period of time or a certain construction process in the future, the multi-step prediction was compared under different input steps, output steps, and interval steps, and the influence of the multi-step prediction on the prediction performance of the model was further discussed. The interval 0 step was the continuous prediction. According to the analysis of the single-step prediction, the input step lengths 2, 4, and 6 were used to explore the effect of multi-step prediction.
3.3.1. Multi-Step Continuous Prediction Analysis
If the output step length of multi-step continuous prediction was n, there would n data repetitions per rolling, which would increase the test set to n times. As can be seen in
Figure 7, the error would accumulate when the rolling prediction method was used for extrapolation. With longer prediction step lengths, the effect of multi-step continuous prediction also exhibited a discernible declining trend. The fit of the curve became worse and the error increased with the increasing prediction step size, resulting in poor model prediction accuracy. As a result, considering the degree of curve fitting, the forecast accuracy revealed that the effects of successive single-step predictions (output step-1) were superior to successive two-step predictions (output step-2) and superior to successive three-step predictions (output step-3) and four-step predictions (output step-4), respectively.
The analysis of
Table 4 reveals that the continuous two-step prediction’s curve fitting degree R
2 of 0.76 was 18% lower than that of the single-step prediction. However, when compared to the continuous three- and four-step predictions, the MAE and RMSE values were relatively the lowest and the accuracy was highest. Overall, as the number step of prediction increased, the MAE and RMSE values rose, and the model’s prediction accuracy rapidly deteriorated. The curve fitting degree deteriorated at the same time that the R
2 index dropped. The accuracy of the continuous prediction of the following three and four steps was less accurate than that of the previous two steps, but the R
2 values of 0.70 and 0.60, respectively, also have some reference relevance.
3.3.2. Multi-Step Interval Prediction Analysis
The outcomes of the multi-step sequential predictions suggest that the more step in the prediction, the worse the corresponding prediction. Therefore, to increase the output step length of the model training, the number of output steps was chosen to be two for multi-step interval prediction to further explore the prediction performance of the model.
The multi-step prediction effect is shown in
Figure 8 a,c,e below to be broadly equivalent to the single-step prediction effect, both showing a clear pattern of a declining curve fit as the interval step increases, with continuous prediction having the highest accuracy.
Figure 8b,d,f show that the relative inaccuracy of the multi-step prediction increases along with the lengthening of the interval step. The interval 0 step relative errors varied approximately 14%, with outstanding accuracy; the interval 1 step relative errors were roughly two to three times higher than those for the interval 0 step, and the interval 2 step prediction effect relative errors were significantly higher. As a result, the accuracy of the prediction findings was more influenced by the number of interval steps. According to the degree of curve fitting, the effect of each interval’s prediction inaccuracy was as follows: interval 0 > interval 1 > interval 2.
Table 5 shows that interval prediction significantly affected the outcome of the prediction. The accuracy of multi-step interval prediction is equal to that of single-step interval prediction in terms of the three indicators, with the individual evaluation indicators and associated prediction accuracy declining with the increasing interval step size. Although the interval 0 step prediction’s R
2 value of 77% was higher than in intervals 1 and 2, the difference in values is insignificant in terms of the number of times the anticipated values will repeat. Therefore, the interval 0 step was used to predict the gas concentration in the early stage of a process in the face of the palm, and the values of the follow-up interval 1 and 2 steps can provide reference for the field.
3.4. Comparison of Stepwise Prediction Effects
3.4.1. Comparison of Single and Multi-Step Prediction Effects
In order to explore the trend of the gas concentration value at a certain point in the future or the change of gas concentration within a certain time period for each construction process at the palm face, the optimal values of the distribution prediction for the three evaluation indicators with different output steps and interval steps were extracted and analyzed separately for comparison, as shown in
Table 6 and
Table 7 below.
Table 6 shows that when the stepwise continuous prediction step length increases, the three evaluation indices continue to worsen, and that there is a general downward trend in the model’s prediction performance. Although the accuracy of single-step prediction is higher than that of multi-step prediction, the trend of gas concentration predicted by multi-step prediction was more significant for short-term field construction. The optimal step length of single-step and multi-step were extracted respectively to further explore the effect of stepwise interval prediction on the performance of the model (see
Table 7).
Among them, the comparison of stepwise interval prediction as shown in
Table 7 are as follows:
- (1)
As the interval step length increases, the three assessment metrics for both single-step and two-step predictions continue to degrade, which also affects the model’s accuracy. For the identical single-step prediction instance, the MAE, RMSE, and R2 metrics decreased from 0.032, 0.043, and 0.942 to 0.057, 0.068, and 0.80 correspondingly for interval 0 step compared to interval 1 step, a decrease of 43.8%, 36.7%, and 15%, respectively. This is shown by the fact that interval 0 step prediction generalized more accurately and learned the time series data’s features more efficiently;
- (2)
Under different interval steps, single-step prediction had a higher evaluation index than two-step prediction. For instance, the single-step prediction’s MAE, RMSE, and R2 metrics for the interval 0-step scenario are, respectively, 30.4%, 25.9%, and 17.8% lower than the 2-step predictions. This result verifies that the model takes into account the results of the previous prediction step when making rolling prediction, allowing errors to accumulate. The prediction error at each step increased as the length of prediction step increased, thus causing the predicted sequence to deviate from the original sequence. That is, the bigger the length of the output step, the more errors would be accumulated, which in turn leads to a poorer accuracy of the model.
3.4.2. Parameter Selection and Model Optimization
The output step and interval step length will significantly lessen the temporal dependence between data, which will have a significant impact on the accuracy of the prediction results, according to the discussion results of the aforementioned stepwise prediction. The outcomes of continuous versus interval forecasts and single-step versus multi-step predictions are compared in this study, and the best set of parameters is chosen, as shown in
Table 8.
The single-step continuous and interval prediction of gas concentration can be realized by figuring out the best stepwise prediction parameters, and the gas concentration value at any moment within the forecast range may be acquired. In order to achieve high accuracy in the gas concentration change trend in the stepwise prediction range (t+1~t+5), it is also capable of converting from single-step to multi-step prediction, as shown in
Figure 9.
Therefore, the results of stepwise prediction can not only dynamically predict the gas concentration at a high level in the early stage of each construction process, but also provide a reference for mastering the size and trend of gas concentration after the excavation of the tunnel face in advance. At the same time, it can also provide some basic support and time reserve for the site ventilation efficiency and construction progress, and then provide an important guarantee for tunnel ventilation energy saving, efficient production and construction safety.
Additionally, the data samples can be continuously expanded in conjunction with the field automatic monitoring system to fulfill the goal of dynamic updating, which will improve the generalizability of the model. In order to determine whether a more suitable prediction model for the site and a more precise prediction of the trend of short-term gas concentration in the future can be obtained, the prediction method of "adaptive grid search method + real-time updating of data samples" was used, as shown in
Figure 10.