Research on Runoff Prediction Based on Time2Vec-TCN-Transformer Driven by Multi-Source Data
Abstract
:1. Introduction
2. Related Work
2.1. Time2Vec
2.2. TCN
2.2.1. Causal Convolution
2.2.2. Dilated Convolution
2.2.3. Residual Connection
2.3. Transformer
- Embedding Layer: Similar to the embedding layer in NLP, each time step in the time series data is encoded through the embedding layer to transform it into a vector representation. These vector representations contain information about the time step as well as other relevant features.
- Positional Encoding: Since Transformer lacks built-in capabilities to handle temporal information, positional encoding is added to inform the model about the relative position of each time step. This can be achieved by adding positional encoding vectors to the embedding vectors. The specific formula is as follows:
- Self-Attention Mechanism: Self-attention mechanism aids the model in capturing dependencies between different time steps in a sequence. It allows the model to selectively attend to other time steps for each time step to determine their importance to the current time step. This enables the model to capture long-term dependencies in the time series. Self-attention mechanism is a type of attention mechanism that reduces reliance on external information and is better at capturing internal correlations within data or features. Compared to traditional recurrent neural networks, it exhibits superior parallel computing capabilities.This module has three input vectors—query vector , key vector , and value vector —all of which are computed from input vectors. By computing the dot product of a single query vector and all key vectors, dividing it by , and then applying a function to obtain corresponding weights, the model weights the value vectors. The specific formula is as follows:
- Residual Connection: This allows the network to focus only on the current differences, preventing the problem of vanishing gradients caused by deepening network layers.
- Feedforward Neural Network: It is a two-layer fully connected layer that further processes the output of the self-attention mechanism.
- Output Layer: The output of the encoder layer is fed into a fully connected output layer to generate predictions for the time series. Meanwhile, the dimensionality of the output layer matches the dimensionality of the time series.
2.4. Time2Vec-TCN-Transformer Prediction Model
- First, select four feature variables including daily runoff, water level, temperature, and precipitation as input data, with daily runoff as the output data. Then, perform normalization to uniformly adjust the original data to the interval [0, 1], to accelerate the convergence speed of the model and improve the prediction accuracy.
- After preprocessing, Time2Vec is used as the positional embedding. The data are mapped from the original 4-dimensional feature space to a 64-dimensional hidden space using Time2Vec, which introduces periodic features of time using sinusoidal functions. Then, the data are mapped back to the original dimensionality through linear transformation and fed into the TCN layer. Time2Vec is employed to address the lack of a learnable encoding mechanism in Transformer.
- In the TCN layer, multiple convolutional layers are utilized to extract features from the input time series data. Dilated convolution is employed to capture longer-term temporal dependencies. Weight normalization and ReLU activation functions are used as residual connections between layers. The output is then fed into the Transformer layer. Specifically, a hidden layer with units [1,4,16,64] is defined. The convolutional kernel size is set to 1 × 3, and the dilation factors are 1, 2, 4, and 8, respectively.
- In the Transformer layer, positional embedding and the data processed through the TCN layer are further processed through an attention mechanism to introduce correlation information between different time steps and different feature variables. The output is then passed through residual connections and layer normalization before being fed into a feedforward network. Since only a single variable, runoff volume, needs to be output, no decoder parallel computation is used. Instead, a single feedforward neural network is employed to map the data to one dimension for output.
- Finally, after training is completed, the predicted results are inverse-normalized to more accurately assess the gap between the predicted values and the actual values.
3. Experiment and Results
3.1. Data Description
3.2. Performance Evaluation
3.3. Results and Analysis
4. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Jabbari, A.; Bae, D.-H. Application of Artificial Neural Networks for Accuracy Enhancements of Real-Time Flood Forecasting in the Imjin Basin. Water 2018, 10, 1626. [Google Scholar] [CrossRef]
- de la Fuente, A.; Meruane, V.; Meruane, C. Hydrological Early Warning System Based on a Deep Learning Runoff Model Coupled with a Meteorological Forecast. Water 2019, 11, 1808. [Google Scholar] [CrossRef]
- Silvestro, F.; Gabellani, S.; Rudari, R.; Delogu, F.; Laiolo, P.; Boni, G. Uncertainty reduction and parameter estimation of a distributed hydrological model with ground and remote-sensing data. Hydrol. Earth Syst. Sci. 2015, 19, 1727–1751. [Google Scholar] [CrossRef]
- Yang, Q.; Zhang, H.; Wang, G.; Luo, S.; Chen, D.; Peng, W.; Shao, J. Dynamic runoff simulation in a changing environment: A data stream approach. Environ. Model. Softw. 2019, 112, 157–165. [Google Scholar] [CrossRef]
- Manguerra, H.; Engel, B. HYDROLOGIC PARAMETERIZATION OF WATERSHEDS FOR RUNOFF PREDICTION USING SWAT 1. JAWRA J. Am. Water Resour. Assoc. 1998, 34, 1149–1162. [Google Scholar] [CrossRef]
- Carleo, G.; Cirac, I.; Cranmer, K.; Daudet, L.; Schuld, M.; Tishby, N.; Vogt-Maranto, L.; Zdeborová, L. Machine learning and the physical sciences. Rev. Mod. Phys. 2019, 91, 045002. [Google Scholar] [CrossRef]
- Salas, J.D.; Tabios III, G.Q.; Bartolini, P. Approaches to multivariate modeling of water resources time series 1. JAWRA J. Am. Water Resour. Assoc. 1985, 21, 683–708. [Google Scholar] [CrossRef]
- Guo, Y.; Liu, Y.; Oerlemans, A.; Lao, S.; Wu, S.; Lew, M.S. Deep learning for visual understanding: A review. Neurocomputing 2016, 187, 27–48. [Google Scholar] [CrossRef]
- Li, W.; Kiaghadi, A.; Dawson, C. High temporal resolution rainfall–runoff modeling using long-short-term-memory (LSTM) networks. Neural Comput. Appl. 2021, 33, 1261–1278. [Google Scholar] [CrossRef]
- Le, X.-H.; Ho, H.V.; Lee, G. Application of gated recurrent unit (GRU) network for forecasting river water levels affected by tides. In Proceedings of the APAC 2019: The 10th International Conference on Asian and Pacific Coasts, Hanoi, Vietnam, 25–28 September 2019; pp. 673–680. [Google Scholar]
- Amanambu, A.C.; Mossa, J.; Chen, Y.-H. Hydrological drought forecasting using a deep transformer model. Water 2022, 14, 3611. [Google Scholar] [CrossRef]
- Deng, H.; Chen, W.; Huang, G. Deep insight into daily runoff forecasting based on a CNN-LSTM model. Nat. Hazards 2022, 113, 1675–1696. [Google Scholar] [CrossRef]
- Qiao, G.; Yang, M.; Zeng, X. Monthly-scale runoff forecast model based on PSO-SVR. J. Phys. Conf. Ser. 2022, 2189, 012016. [Google Scholar] [CrossRef]
- Wang, W.-C.; Cheng, Q.; Chau, K.-W.; Hu, H.; Zang, H.-F.; Xu, D.-M. An enhanced monthly runoff time series prediction using extreme learning machine optimized by salp swarm algorithm based on time varying filtering based empirical mode decomposition. J. Hydrol. 2023, 620, 129460. [Google Scholar] [CrossRef]
- Jiang, Y.; Li, C.; Sun, L.; Guo, D.; Zhang, Y.; Wang, W. A deep learning algorithm for multi-source data fusion to predict water quality of urban sewer networks. J. Clean. Prod. 2021, 318, 128533. [Google Scholar] [CrossRef]
- Zhang, J.W.; Chen, X.H.; Khan, A.; Zhang, Y.K.; Kuang, X.X.; Liang, X.Y.; Taccari, M.L.; Nuttall, J. Daily runoff forecasting by deep recursive neural network. J. Hydrol. 2021, 596, 126067. [Google Scholar] [CrossRef]
- Gao, S.; Huang, Y.F.; Zhang, S.; Han, J.C.; Wang, G.Q.; Zhang, M.X.; Lin, Q.S. Short-term runoff prediction with GRU and LSTM networks without requiring time step optimization during sample generation. J. Hydrol. 2020, 589, 125188. [Google Scholar] [CrossRef]
- Xu, Y.; Hu, C.; Wu, Q.; Jian, S.; Li, Z.; Chen, Y.; Zhang, G.; Zhang, Z.; Wang, S. Research on particle swarm optimization in LSTM neural networks for rainfall-runoff simulation. J. Hydrol. 2022, 608, 127553. [Google Scholar] [CrossRef]
- Rust, J. Structural estimation of Markov decision processes. Handb. Econom. 1994, 4, 3081–3143. [Google Scholar]
- Song, C.M. Data construction methodology for convolution neural network based daily runoff prediction and assessment of its applicability. J. Hydrol. 2022, 605, 127324. [Google Scholar] [CrossRef]
- Hassani, H.; Silva, E.S. Predictions from Generative Artificial Intelligence Models: Towards a New Benchmark in Forecasting Practice. Information 2024, 15, 291. [Google Scholar] [CrossRef]
- Diebold, F.X.; Mariano, R.S. Comparing predictive accuracy. J. Bus. Econ. Stat. 2002, 20, 134–144. [Google Scholar] [CrossRef]
- Hassani, H.; Silva, E.S. A Kolmogorov-Smirnov based test for comparing the predictive accuracy of two sets of forecasts. Econometrics 2015, 3, 590–609. [Google Scholar] [CrossRef]
- Kazemi, S.M.; Goel, R.; Eghbali, S.; Ramanan, J.; Sahota, J.; Thakur, S.; Wu, S.; Smyth, C.; Poupart, P.; Brubaker, M. Time2vec: Learning a vector representation of time. arXiv 2019, arXiv:1907.05321. [Google Scholar]
- Hewage, P.; Behera, A.; Trovati, M.; Pereira, E.; Ghahremani, M.; Palmieri, F.; Liu, Y. Temporal convolutional neural (TCN) network for an effective weather forecasting using time-series data from the local weather station. Soft Comput. 2020, 24, 16453–16482. [Google Scholar] [CrossRef]
- Gan, Z.; Li, C.; Zhou, J.; Tang, G. Temporal convolutional networks interval prediction model for wind speed forecasting. Electr. Power Syst. Res. 2021, 191, 106865. [Google Scholar] [CrossRef]
- Xu, Y.; Hu, C.; Wu, Q.; Li, Z.; Jian, S.; Chen, Y. Application of temporal convolutional network for flood forecasting. Hydrol. Res. 2021, 52, 1455–1468. [Google Scholar] [CrossRef]
- Lin, K.; Chen, H.; Zhou, Y.; Sheng, S.; Luo, Y.; Guo, S.; Xu, C.-Y. Exploring a similarity search-based data-driven framework for multi-step-ahead flood forecasting. Sci. Total Environ. 2023, 891, 164494. [Google Scholar] [CrossRef]
- Zhu, R.; Liao, W.; Wang, Y. Short-term prediction for wind power based on temporal convolutional network. Energy Rep. 2020, 6, 424–429. [Google Scholar] [CrossRef]
- 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. [Google Scholar] [CrossRef]
- Castangia, M.; Grajales, L.M.M.; Aliberti, A.; Rossi, C.; Macii, A.; Macii, E.; Patti, E. Transformer neural networks for interpretable flood forecasting. Environ. Model. Softw. 2023, 160, 105581. [Google Scholar] [CrossRef]
- Xu, Z.X.; Li, J.Y.; Liu, C. Long-term trend analysis for major climate variables in the Yellow River basin. Hydrol. Process. Int. J. 2007, 21, 1935–1948. [Google Scholar] [CrossRef]
- Hao, S.; Wang, W.; Ma, Q.; Li, C.; Wen, L.; Tian, J.; Liu, C. Model-based mechanism analysis of “7.20” flash flood disaster in Wangzongdian River basin. Water 2023, 15, 304. [Google Scholar] [CrossRef]
- Wang, G.; Zhang, J.; Li, X.; Bao, Z.; Liu, Y.; Liu, C.; He, R.; Luo, J. Investigating causes of changes in runoff using hydrological simulation approach. Appl. Water Sci. 2017, 7, 2245–2253. [Google Scholar] [CrossRef]
Model Comparison | Next Day | Next 2 Days | Next 3 Days | Next 4 Days |
---|---|---|---|---|
Time2Vec-TCN-Transformer: LSTM | −16.277 *** | −12.187 *** | −8.857 *** | −6.911 *** |
Time2Vec-TCN-Transformer: TCN | −11.015 *** | −7.103 *** | −4.922 *** | −3.848 *** |
Time2Vec-TCN-Transformer: TCN-Transformer | −8.743 *** | −4.525 *** | −3.541 *** | −2.522 *** |
Time | Model | MAE | RRMSE | MAPE | NSE |
---|---|---|---|---|---|
Next day | LSTM | 141.726 | 0.194 | 11.724 | 0.941 |
TCN | 84.451 | 0.118 | 7.847 | 0.978 | |
TCN-Transformer | 68.544 | 0.089 | 7.556 | 0.988 | |
Time2Vec-TCN-Transformer | 39.825 | 0.059 | 3.610 | 0.995 | |
Next 2 days | LSTM | 170.587 | 0.243 | 13.033 | 0.908 |
TCN | 113.791 | 0.166 | 9.531 | 0.953 | |
TCN-Transformer | 95.834 | 0.147 | 8.741 | 0.966 | |
Time2Vec-TCN-Transformer | 70.293 | 0.108 | 5.678 | 0.982 | |
Next 3 days | LSTM | 197.799 | 0.292 | 14.464 | 0.868 |
TCN | 148.350 | 0.227 | 11.399 | 0.919 | |
TCN-Transformer | 134.716 | 0.212 | 11.367 | 0.930 | |
Time2Vec-TCN-Transformer | 104.758 | 0.172 | 8.133 | 0.954 | |
Next 4 days | LSTM | 226.870 | 0.340 | 16.144 | 0.820 |
TCN | 182.477 | 0.287 | 13.054 | 0.872 | |
TCN-Transformer | 165.778 | 0.263 | 13.303 | 0.893 | |
Time2Vec-TCN-Transformer | 138.303 | 0.229 | 10.590 | 0.918 |
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. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Liu, Y.; Wang, Y.; Liu, X.; Wang, X.; Ren, Z.; Wu, S. Research on Runoff Prediction Based on Time2Vec-TCN-Transformer Driven by Multi-Source Data. Electronics 2024, 13, 2681. https://doi.org/10.3390/electronics13142681
Liu Y, Wang Y, Liu X, Wang X, Ren Z, Wu S. Research on Runoff Prediction Based on Time2Vec-TCN-Transformer Driven by Multi-Source Data. Electronics. 2024; 13(14):2681. https://doi.org/10.3390/electronics13142681
Chicago/Turabian StyleLiu, Yang, Yize Wang, Xuemei Liu, Xingzhi Wang, Zehong Ren, and Songlin Wu. 2024. "Research on Runoff Prediction Based on Time2Vec-TCN-Transformer Driven by Multi-Source Data" Electronics 13, no. 14: 2681. https://doi.org/10.3390/electronics13142681
APA StyleLiu, Y., Wang, Y., Liu, X., Wang, X., Ren, Z., & Wu, S. (2024). Research on Runoff Prediction Based on Time2Vec-TCN-Transformer Driven by Multi-Source Data. Electronics, 13(14), 2681. https://doi.org/10.3390/electronics13142681