4.1. Comparison of Modeling and Prediction Effects of Commonly Used Models
In this study, SVR, LSTM, GRU, and LSTNet models were used to model and predict temperature and humidity parameters in the breeding environment of predatory mites. The models were programmed in Python and based on the PyTorch deep learning framework. Multiple evaluation metrics were used to compare model performance. The computer configuration was as follows: CPU: i5-13600KF; GPU: 4060Ti; Memory: 32GB; Environment: Python 3.11, PyTorch 2.1.0.
To compare the performance of the SVR, LSTM, GRU, and LSTNet models, experiments were set up to predict air temperature and humidity with prediction steps of 1, 3, 6, and 24. The prediction task in the experiments was defined as using hourly historical temperature and humidity data from the past three days to predict the temperature and humidity for the next 1, 3, 6, and 24 hours. The evaluation metrics for the prediction results of the four models and four steps for temperature and humidity are shown in
Table 1,
Table 2,
Table 3,
Table 4,
Table 5 and
Table 6.
As observed in
Figure 6, the LSTNet model exhibits lower RMSE and MAE metrics for temperature and humidity predictions at 1, 3, 6, and 24 steps compared to other models. This indicates that the LSTNet model has the smallest error between the predicted and actual values in the temperature and humidity prediction tasks.
As shown in
Figure 7 and
Figure 8, to visually and accurately understand the prediction performance of each model, a sequence length of 168 was extracted from the test data, and the prediction results were plotted to compare the prediction results of the four models in the one-step temperature and humidity prediction task. Each curve in the figures represents the model's predicted values over time. By visually inspecting the charts, the degree of consistency between each model's predictions and the actual values can be observed.
The comparison charts provide a visual representation of the predicted and actual values for each model, allowing for a comprehensive evaluation of their predictive capabilities.
In the comparison charts of the one-step temperature and humidity prediction results for the four models, the LSTNet model performs the best, with minimal noticeable errors between the predicted and actual values. Additionally, it can be observed that the LSTNet model more accurately captures relevant details compared to other models, especially when there is a certain change in the actual data trend. The autoregressive component in the LSTNet model effectively captures the direction and scale of data changes, significantly improving prediction accuracy. In contrast, the errors of other models increase significantly when the data trend changes.
By comparing the performance of the four models in the prediction tasks at four different steps, it is evident that the LSTNet model is more suitable for modeling and predicting temperature and humidity data in the breeding environment of predatory mites. However, in multi-step prediction tasks, the LSTNet model exhibits larger prediction errors for time series containing multiple data patterns due to the lag effect of the input data. Considering the introduction of time series clustering methods can improve the model's adaptability to different data patterns.
4.2. Temperature and Humidity Estimation Based on TSFHC-LSTNet
In the time series of temperature and humidity in the breeding environment of predatory mites, there are multiple data variation patterns. In multi-step prediction tasks for temperature and humidity, when the data trend and amplitude, i.e., the data variation pattern, change, a single LSTNet model finds it difficult to identify the shift in data variation patterns based solely on the two variables of temperature and humidity. Instead, it maintains the original data variation pattern for predicting temperature and humidity, and the predicted results resemble the most recent cycle data in the input sequence, leading to significant prediction errors, as shown in
Figure 9.
Note:
Figure 10 shows the estimated temperature and humidity values for December 29, 2023 using hourly temperature and humidity data from December 21, 2023 to December 28, 2023.
In this study, feature vectors corresponding to short sequences were constructed by calculating the mean, variance, and fifth-order polynomial fitting coefficients of the temperature and humidity sequences. The mean and variance represent the level and dispersion degree of the sequence values, respectively, while the polynomial fitting coefficients can represent the trend and amplitude of data changes to a certain extent.
Since temporal feature hierarchical clustering can divide the dataset into multiple subsets according to different data variation patterns, this can result in a smaller amount of data in each subset, affecting the predictive performance of the LSTNet model. Therefore, a larger amount of data is required during clustering. Temporal feature hierarchical clustering was performed using temperature and humidity data from Fuzhou City from 2018 to 2023. Agglomerative hierarchical clustering was used, and based on the dendrogram of the clustering results, an appropriate threshold was selected to divide the data into eight clusters, constructing corresponding datasets.
The LSTNet model was then used to train on the data from these eight clusters, with each dataset divided into training, validation, and test sets in a ratio of 8:1:1. The results are shown in the table below.
Table 7.
TSFHC-LSTNet temperature estimation index.
Table 7.
TSFHC-LSTNet temperature estimation index.
| |
Cluster1 |
Cluster2 |
Cluster3 |
Cluster4 |
Cluster5 |
Cluster6 |
Cluster7 |
Cluster8 |
total |
| RMSE |
1.00 |
0.89 |
1.57 |
1.74 |
1.68 |
2.17 |
2.11 |
2.10 |
1.60 |
| MAE |
0.79 |
0.67 |
1.29 |
1.42 |
1.33 |
1.73 |
1.62 |
1.68 |
1.20 |
| r |
0.9601 |
0.9179 |
0.8248 |
0.8883 |
0.7670 |
0.6745 |
0.9118 |
0.9327 |
0.9746 |
| R2 |
0.8565 |
0.8230 |
0.5230 |
0.7826 |
0.3921 |
0.1269 |
0.8006 |
0.8347 |
0.9469 |
Table 8.
TSFHC-LSTNet humidity estimation index.
Table 8.
TSFHC-LSTNet humidity estimation index.
| |
Cluster1 |
Cluster2 |
Cluster3 |
Cluster4 |
Cluster5 |
Cluster6 |
Cluster7 |
Cluster8 |
total |
| RMSE |
4.20 |
5.06 |
3.49 |
4.13 |
4.53 |
5.73 |
5.32 |
4.26 |
4.51 |
| MAE |
3.19 |
3.91 |
2.65 |
3.16 |
3.18 |
4.46 |
4.07 |
3.18 |
3.37 |
| r |
0.9277 |
0.9259 |
0.8398 |
0.8937 |
0.9031 |
0.9542 |
0.9448 |
0.9538 |
0.9366 |
| R2 |
0.8312 |
0.8279 |
0.6548 |
0.7872 |
0.7780 |
0.9028 |
0.8858 |
0.9002 |
0.8639 |
To study the difference in model performance before and after data enhancement, the temperature and humidity time series from 2018 to 2023 were directly used as the dataset, with 2023 data serving as the test set. The LSTNet model was trained with a prediction step of 24 steps. The test set results for temperature prediction had an RMSE of 2.2 and an MAE of 1.58, while the humidity prediction results had an RMSE of 6.71 and an MAE of 4.9.
Compared to the single LSTNet model, the TSFHC-LSTNet model (Temporal Sequence Feature Hierarchical Clustering with LSTNet) showed significant improvement in prediction accuracy. The temperature prediction RMSE decreased by 27.3%, and the MAE decreased by 24.1%. Tshe humidity prediction RMSE decreased by 32.8%, and the MAE decreased by 31.2%. These results indicate a significant improvement in prediction accuracy after clustering and modeling.
Using the TSFHC-LSTNet model can significantly reduce the prediction errors caused by changes in data variation patterns. As shown in
Figure 10, in the temperature prediction on December 29, 2023, the TSFHC-LSTNet model achieved an MAE of 1.81, which is a 39% reduction compared to the MAE of 2.97 from the single LSTNet model.
In situations where the data variation patterns change less, the TSFHC-LSTNet model still outperforms the LSTNet model. For example, as shown in
Figure 11, the temperature prediction results on July 26, 2023, demonstrate that the TSFHC-LSTNet model achieved an MAE of 0.53, which is a 15.9% reduction compared to the MAE of 0.63 from the LSTNet model.
Similar to temperature prediction, as shown in
Figure 12, the humidity prediction results on December 26, 2023, indicate that the single LSTNet model had a significant error, with an MAE of 8.56. In contrast, the TSFHC-LSTNet model achieved an MAE of 4.91, a reduction of 42.6% compared to the LSTNet model. As illustrated in
Figure 13, the humidity prediction results on June 20, 2023, showed that the LSTNet model had a certain prediction error, with an MAE of 2.95, while the TSFHC-LSTNet model achieved an MAE of 1.59, a reduction of 46.1% compared to the LSTNet model.
In summary, using the LSTNet model based on temporal feature hierarchical clustering can significantly reduce the prediction errors in multi-step temperature and humidity prediction tasks compared to a single LSTNet model.