Time-Series Interval Forecasting with Dual-Output Monte Carlo Dropout: A Case Study on Durian Exports
Abstract
:1. Introduction
- Comprehensive uncertainty estimation: provides both aleatoric and epistemic uncertainties, offering a complete uncertainty profile;
- Improved forecast accuracy: achieves a lower RMSE compared to traditional models like SARIMA;
- Practical application: demonstrated effectiveness on real-world data with significant seasonal variations and trends;
- Enhanced model regularization: utilizes dropout techniques to prevent overfitting, ensuring robust performance;
- Flexible architecture: capable of handling complex, non-linear relationships in time-series data.
2. Related Theories
2.1. Aleatoric and Epistemic Uncertainties
2.1.1. Aleatoric Uncertainty
2.1.2. Epistemic Uncertainty
2.2. Deep Neural Networks
2.3. Activation Functions
- The Sigmoid function is defined as σ(x) = 1/(1 + exp(−x)), and it outputs values between 0 and 1. It is a smooth, S-shaped curve that has been widely used historically, especially for binary classification problems;
- The Tanh function or hyperbolic tangent function, tanh(x), rescales the sigmoid to output values between −1 and 1. It is zero-centered, making it preferred in certain scenarios as it can help with improving the convergence during the training phase;
- The ReLU function, defined as ReLu(x) = max(0,x), activates a neuron only if the input is above zero, providing a piecewise linear output that is computationally efficient and enables the model to leverage sparsity for better performance and faster training.
2.4. Regularization
2.5. Dropout as Bayesian Approximation
- A variational distribution q(θ) is defined, parameterized by ϕ. In the MCDO context, this equates to integrating dropout within the network;
- During each forward pass, weights θt are sampled from q(θ) by applying dropout, which effectively samples a thinned network;
- The output is computed using these sampled weights, which can be denoted as yt = f(x;θt), where f is the neural network with dropout applied and x is the input.
2.6. Loss Function Incorporating MCDO
2.7. Predictive Distribution for Interval Forecasting
3. Dataset of a Case Study
4. Proposed Methodology
4.1. Feature Engineering
- Time index creation: To capture the temporal trend, a time index was created along with its polynomial terms, such as the square or cube, to model more complex trends. These indices help in identifying underlying patterns over time.
- Quadratic trend estimation: A quadratic regression was fitted to the original data to model the underlying trend and subsequently remove it (detrend), thereby enhancing stationarity. The rationale for choosing a quadratic model is based on the observation that the time-series data for Thailand’s durian export exhibited a quadratic trend. This trend estimation helps in removing long-term trends, making the time series more stationary and easier to model with neural networks. The trend equation is given as the following:
- Lag feature generation: Lag features up to 12 months prior were created to incorporate historical data points as predictors. If the data exhibit different seasonal patterns or other temporal dependencies, the lag feature span can be modified accordingly. The proposed method is robust and can adapt to different lag feature configurations to capture relevant patterns in the data.
- Detrending: To normalize the time-series data yi, where the model is yi = Ti × Si × Ci × Ii (Trend T, Seasonality S, Cyclical C, and Irregular I), the detrending process involves dividing the original data by the estimated trend:
4.2. Data Processing
- Data cleaning: rows with missing values, resulting from lagged feature generation, were removed to maintain consistency;
- Data splitting: the dataset was split into training and test sets, ensuring a temporal split that mimics real-world forecasting scenarios;
- Feature scaling: the features were standardized using StandardScaler() in Python (version 3.11.5) with scikit-learn (version 1.3.0) to normalize the data, improving the neural network’s convergence.
4.3. Neural Network Topology
4.4. Hyperparameter Grid
- A minimal multi-layer perceptron (MLP) with a single hidden layer of several neurons (e.g., 10–20) was initially used to establish a baseline. Based on the baseline performance, the network depth was gradually increased by adding more layers and neurons to capture complex patterns. For instance, starting with a two-layer model (60–30 neurons) and then increasing the network depth by adding more neurons (e.g., 120 neurons for three layers, 180 for four, etc.), while carefully monitoring for overfitting. This step-by-step increase ensures that the added complexity is justified by improved performance;
- Different activation functions such as ReLU, Sigmoid, and Tanh were evaluated for their unique characteristics in modeling;
- Dropout, as a method to combat overfitting, involves deactivating a random subset of neurons during each training cycle. Dropout rates were varied across different layers to explore their combined effects. For instance, with a configuration of [0.4, 0.3, 0.2], the first hidden layer uses a dropout rate of 0.4, the second hidden layer uses 0.3, and the third hidden layer uses 0.2. This gradation from 0.2 up to 0.7 allows for a progression from minimal to more intensive regularization, adapting the model’s complexity and preventing it from memorizing the training data too closely. In some experiments, up to five dropout rates were applied at different points in the network to explore their combined effects on regularization;
- Training sessions for the models were conducted over 25, 50, or 100 epochs, where each epoch represents a full pass of the training data through the learning algorithm. Adjusting the epoch count allows the model to refine its grasp on the dataset, though too many epochs can lead to overfitting, where the model too closely adapts to the training data. Conversely, too few epochs may not provide enough learning opportunity, potentially causing underfitting;
- Batch sizes were varied across 16, 32, 64, or 128 to adjust the quantity of data samples processed simultaneously by the network. Opting for smaller batch sizes tends to enhance the stability of the model’s convergence but may prolong the duration of training. Conversely, larger batches expedite the training phase but could compromise convergence stability and the model’s ability to generalize effectively across unseen data.
4.5. Custom Loss Function
4.6. Training Process
- Model compilation and training: Each model configuration from the hyperparameter grid was compiled and trained on the scaled and split training data. The dataset was divided into training (80%) and testing (20%) subsets to ensure proper training and evaluation. Within the training set, a further split was made to create a validation set (20% of the training set), resulting in 64% of the data used for training, 16% for validation, and 20% for testing;
- Validation set evaluation: The validation set (16% of the total data) was used to evaluate the performance of each model configuration. The root mean squared error (RMSE) on the validation set was used as the primary metric to compare different hyperparameter settings. The model configuration with the lowest validation RMSE was selected as the optimal model;
- MCDO for uncertainty estimation: post-training, MCDO was employed to generate predictive distributions by performing multiple forward passes with dropout enabled, aggregating the results to estimate the mean and variance of predictions.
4.7. Tuning of Models
4.7.1. Proposed Method
4.7.2. Benchmark Method
4.8. Applying Dual-Output MCDO for Interval Forecasting
- Mean output: This layer predicts the expected mean value of durian exports for a future time point. The prediction is formulated as , where x represents the input features, including lagged variables, and ΘMean embodies the network’s learned parameters. Dropout introduces a Bayesian approximation;
- Variance output: This layer estimates the predictive variance, which quantifies the aleatoric uncertainty inherent in the data. The estimated variance is
4.9. Evaluation
- Coverage proportion (%Coverage): This measure indicates the proportion of times the actual values fall within the predicted intervals [39]. It is defined by the following:
- Incidence of non-positive lower limits (%NegLB): This metric calculates how frequently the predicted intervals have a lower limit that is non-positive, which is crucial for datasets where such values are infeasible. It is defined by the following:
- Average width of forecast interval (WidthAvg): Represents the mean distance between the upper and lower bounds of forecast intervals [40]. It is defined as follows:
- Root mean squared error (RMSE): This is a measure of the average discrepancy between the predicted and actual values. It is defined by the following:
- Coefficient of determination (R2): Indicates the fraction of the variance in the observed values that is predictable from the independent variables. It is defined by the following:
- The seasonal autoregressive integrated moving average (SARIMA) model is an extension of the ARIMA model that specifically addresses and models seasonal components of a time series [41,42]. Choosing SARIMA as a benchmark for comparison with proposed forecast intervals for durian export is strategic due to its comprehensive ability to model both seasonal and non-seasonal patterns in time-series data. Elements of SARIMA include non-seasonal (p, d, q) and seasonal (P, D, Q, S) terms, where p and P represent the order of the autoregressive terms, d and D signify the degree of differencing, q and Q denote the order of the moving average terms, and S corresponds to the length of the seasonal cycle. The SARIMA model is defined by the following:
5. Results
5.1. Optimal Model and Effects of the Parameters
5.2. Distributions of Forecasting Means
5.3. Distributions of Forecasting Variances
5.4. Forecast Intervals of Durian Export
6. Conclusions and Discussion
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Gal, Y.; Ghahramani, Z. Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning. In Proceedings of the 33rd International Conference on Machine Learning, New York, NY, USA, 20–22 June 2016; Balcan, M.F., Weinberger, K.Q., Eds.; PMLR: Westminster, UK, 2016; pp. 1050–1059. Available online: https://proceedings.mlr.press/v48/gal16.html (accessed on 29 May 2024).
- Kendall, A.; Gal, Y. What Uncertainties Do We Need in Bayesian Deep Learning for Computer Vision. In Proceedings of the 31st International Conference on Neural Information Processing Systems, Long Beach, CA, USA, 4–9 December 2017; Guyon, I., Von Luxburg, U., Bengio, S., Eds.; Curran Associates Inc.: Red Hook, NY, USA, 2017; pp. 5580–5590. Available online: https://papers.nips.cc/paper_files/paper/2017/file/2650d6089a6d640c5e85b2b88265dc2b-Paper.pdf (accessed on 29 May 2024).
- Srivastava, N.; Hinton, G.; Krizhevsky, A.; Sutskever, I.; Salakhutdinov, R. Dropout: A simple way to prevent neural networks from overfitting. J. Mach. Learn. Res. 2014, 15, 1929–1958. [Google Scholar]
- Zhang, C.; Sun, S.; Yu, G. A Bayesian network approach to time series forecasting of short-term traffic flows. In Proceedings of the 7th International IEEE Conference on Intelligent Transportation Systems, Washington, WA, USA, 3–6 October 2004; pp. 216–221. [Google Scholar] [CrossRef]
- Pearce, T.; Leibfried, F.; Brintrup, A. Uncertainty in Neural Networks: Approximately Bayesian Ensembling. In Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, Online, 26–28 August 2020; Chiappa, S., Calandra, R., Eds.; Volume 108, pp. 234–244. Available online: http://proceedings.mlr.press/v108/pearce20a/pearce20a.pdf (accessed on 29 May 2024).
- Fortunato, M.; Blundell, C.; Vinyals, O. Bayesian Recurrent Neural Networks. arXiv 2019, arXiv:1704.02798. [Google Scholar] [CrossRef]
- Blundell, C.; Cornebise, J.; Kavukcuoglu, K.; Wierstra, D. Weight Uncertainty in Neural Networks. arXiv 2015, arXiv:1505.05424. [Google Scholar] [CrossRef]
- Srisuradetchai, P.; Lisawadi, S.; Thanakorn, P. Improved Neural Network Predictions with Correlation-Based Subset Selection. In Proceedings of the 2024 12th International Electrical Engineering Congress (iEECON), Pattaya, Thailand, 6–8 March 2024. [Google Scholar] [CrossRef]
- Fan, C.; Zhang, Y.; Pan, Y.; Li, X.; Zhang, C.; Yuan, R.; Wu, D.; Wang, W.; Pei, J.; Huang, H. Multi-Horizon Time Series Forecasting with Temporal Attention Learning. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (KDD 1‘9), Anchorage, AK, USA, 4–8 August 2019; Association for Computing Machinery: New York, NY, USA; pp. 2527–2535. [Google Scholar] [CrossRef]
- Lemay, A.; Hoebel, K.; Bridge, C.P.; Befano, B.; De Sanjosé, S.; Egemen, D.; Rodriguez, A.C.; Schiffman, M.; Campbell, J.P.; Kalpathy-Cramer, J. Improving the repeatability of deep learning models with Monte Carlo dropout. npj Digit. Med. 2022, 5, 174. [Google Scholar] [CrossRef] [PubMed]
- Alahmari, S.S.; Goldgof, D.B.; Mouton, P.R.; Hall, L.O. Challenges for the repeatability of deep learning models. IEEE Access 2020, 8, 211860–211868. [Google Scholar] [CrossRef]
- Hinton, G.E.; Srivastava, N.; Krizhevsky, A.; Sutskever, I.; Salakhutdinov, R.R. Improving neural networks by preventing co-adaptation of feature detectors. arXiv 2012, arXiv:1207.0580. [Google Scholar] [CrossRef]
- Camarasa, R.; Bos, D.; Hendrikse, J.; Nederkoorn, P.; Kooi, E.; van der Lugt, A.; de Bruijne, M. Quantitative Comparison of Monte-Carlo Dropout Uncertainty Measures for Multi-class Segmentation. In Uncertainty for Safe Utilization of Machine Learning in Medical Imaging, and Graphs in Biomedical Image Analysis. UNSURE GRAIL 2020; Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2020; Volume 12443, pp. 32–41. [Google Scholar] [CrossRef]
- Leibig, C.; Allken, V.; Ayhan, M.S.; Berens, P.; Wahl, S. Leveraging uncertainty information from deep neural networks for disease detection. Sci. Rep. 2017, 7, 17816. [Google Scholar] [CrossRef] [PubMed]
- García González, E.; Villar, J.R.; de la Cal Marín, E.A. Time Series Data Augmentation and Dropout Roles in Deep Learning Applied to Fall Detection. In Proceedings of the 15th International Conference on Soft Computing Models in Industrial and Environmental Applications (SOCO 2020), Burgos, Spain, 24–26 June 2020; Springer: Cham, Switzerland, 2020; pp. 563–570. [Google Scholar] [CrossRef]
- Maleki Sadr, M.A.; Zhu, Y.; Hu, P. An Anomaly Detection Method for Satellites Using Monte Carlo Dropout. IEEE Trans. Aerosp. Electron. Syst. 2022, 59, 2044–2052. [Google Scholar] [CrossRef]
- Atencia, M.; Stoean, R.; Joya, G. Uncertainty Quantification through Dropout in Time Series Prediction by Echo State Networks. Mathematics 2020, 8, 1374. [Google Scholar] [CrossRef]
- Sheng, C.; Zhao, J.; Wang, W.; Leung, H. Prediction Intervals for a Noisy Nonlinear Time Series Based on a Bootstrapping Reservoir Computing Network Ensemble. IEEE Trans. Neural Netw. Learn. Syst. 2013, 24, 1036–1048. [Google Scholar] [CrossRef]
- Khosravi, A.; Mazloumi, E.; Nahavandi, S.; Creighton, D.; Van Lint, J.W.C. Prediction Intervals to Account for Uncertainties in Travel Time Prediction. IEEE Trans. Intell. Transp. Syst. 2011, 12, 537–547. [Google Scholar] [CrossRef]
- Murphy, K.P. Machine Learning: A Probabilistic Perspective, 2nd ed.; MIT Press: Cambridge, MA, USA, 2021. [Google Scholar]
- Kingma, D.P.; Welling, M. Auto-Encoding Variational Bayes. In Proceedings of the 2nd International Conference on Learning Representations (ICLR), Banff, AB, Canada, 14–16 April 2014. [Google Scholar]
- Goodfellow, I.; Bengio, Y.; Courville, A. Deep Learning; MIT Press: Cambridge, MA, USA, 2016; Available online: http://www.deeplearningbook.org (accessed on 29 May 2024).
- LeCun, Y.; Bengio, Y.; Hinton, G. Deep learning. Nature 2015, 521, 436–444. [Google Scholar] [CrossRef]
- Glorot, X.; Bordes, A.; Bengio, Y. Deep Sparse Rectifier Neural Networks. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics (AISTATS), Ft. Lauderdale, FL, USA, 11–13 April 2011; Volume 15, pp. 315–323. [Google Scholar]
- Krizhevsky, A.; Sutskever, I.; Hinton, G. Imagenet classification with deep convolutional neural networks. In Proceedings of the Neural Information Processing Systems (NIPS), Lake Tahoe, NV, USA, 3–8 December 2012. [Google Scholar]
- Polson, N.G.; Sokolov, V. Deep Learning: A Bayesian Perspective. Bayesian Anal. 2017, 12, 1275–1304. [Google Scholar] [CrossRef]
- Bauer, M.; van der Wilk, M.; Rasmussen, C.E. Understanding Probabilistic Sparse Gaussian Process Approximations. In Proceedings of the 30th International Conference on Neural Information Processing Systems (NIPS), Barcelona, Spain, 5–10 December 2016; pp. 1533–1541. [Google Scholar]
- Blei, D.M.; Kucukelbir, A.; McAuliffe, J.D. Variational Inference: A Review for Statisticians. arXiv 2016, arXiv:1601.00670. Available online: https://arxiv.org/abs/1601.00670 (accessed on 29 May 2024). [CrossRef]
- Gal, Y.; Hron, J.; Kendall, A. Concrete Dropout. arXiv 2017, arXiv:1705.07832. Available online: https://arxiv.org/abs/1705.07832 (accessed on 29 May 2024).
- MacKay, D. Probable networks and plausible predictions—A review of practical Bayesian methods for supervised neural networks. Netw. Comput. Neural Syst. 1995, 6, 469–505. [Google Scholar] [CrossRef]
- Murphy, K.P. Probabilistic Machine Learning: Advanced Topics; MIT Press: Cambridge, MA, USA, 2023. [Google Scholar]
- MacKay, D. Information Theory, Inference, and Learning Algorithms; Cambridge University Press: Cambridge, UK, 2003. [Google Scholar]
- Thongkaew, S.; Jatuporn, C.; Sukprasert, P.; Rueangrit, P.; Tongchure, S. Factors affecting the durian production of farmers in the eastern region of Thailand. Int. J. Agric. Ext. 2021, 9, 285–293. [Google Scholar] [CrossRef]
- Rattana-Amornpirom, O. The Impacts of ACFTA on Export of Thai Agricultural Products to China. J. ASEAN PLUS Stud. 2020, 1, 44–60. [Google Scholar]
- Office of Agricultural Economics. Agricultural Statistics of Thailand. 2023. Available online: https://impexpth.oae.go.th/export (accessed on 15 December 2023).
- Kasikorn Research Center. Durian: Record High Export Value of USD 934.9 Million in May 2021. 26 May 2021. Available online: https://www.kasikornresearch.com/en/analysis/k-econ/business/Pages/Durian-z3233.aspx (accessed on 12 November 2023).
- Chaisayant, S.; Chindavong, K.; Wattananusarn, P.; Sittikarn, A. Krungthai Research Note. Krungthai Bank Public Company Limited. 15 May 2023. Available online: https://krungthai.com/Download/economyresources/EconomyResourcesDownload_1938Research_Note_15_05_66.pdf (accessed on 9 December 2023).
- Srisuradetchai, P.; Junnumtuam, S. Wald Confidence Intervals for the Parameter in a Bernoulli Component of Zero-Inflated Poisson and Zero-Altered Poisson Models with Different Link Functions. Sci. Technol. Asia 2020, 25, 1–14. Available online: https://ph02.tci-thaijo.org/index.php/SciTechAsia/article/view/175918 (accessed on 30 May 2024).
- Srisuradetchai, P. A Novel Interval Forecast for K-Nearest Neighbor Time Series: A Case Study of Durian Export in Thailand. IEEE Access 2024, 12, 2032–2044. [Google Scholar] [CrossRef]
- Srisuradetchai, P.; Suksrikran, K. Random kernel k-nearest neighbors regression. Front. Big Data 2024, 7, 1402384. [Google Scholar] [CrossRef] [PubMed]
- Sirisha, U.M.; Belavagi, M.C.; Attigeri, G. Profit Prediction Using ARIMA, SARIMA and LSTM Models in Time Series Forecasting: A Comparison. IEEE Access 2022, 10, 124715–124727. [Google Scholar] [CrossRef]
- Manigandan, P.; Alam, M.S.; Alharthi, M.; Khan, U.; Alagirisamy, K.; Pachiyappan, D.; Rehman, A. Forecasting Natural Gas Production and Consumption in United States-Evidence from SARIMA and SARIMAX Models. Energies 2021, 14, 6021. [Google Scholar] [CrossRef]
- Deretić, N.; Stanimirović, D.; Awadh, M.A.; Vujanović, N.; Djukić, A. SARIMA Modelling Approach for Forecasting of Traffic Accidents. Sustainability 2022, 14, 4403. [Google Scholar] [CrossRef]
- Srisuradetchai, P.; Panichkitkosolkul, W.; Phaphan, W. Combining Machine Learning Models with ARIMA for COVID-19 Epidemic in Thailand. In Proceedings of the 2023 Research, Invention, and Innovation Congress: Innovative Electricals and Electronics (RI2C), Bangkok, Thailand, 24–25 August 2023; pp. 155–161. [Google Scholar] [CrossRef]
- Huadsri, S.; Mekruksavanich, S.; Jitpattanakul, A.; Phaphan, W. A Hybrid SARIMAX Model in Conjunction with Neural Networks for the Forecasting of Life Insurance Industry Growth in Thailand. In Proceedings of the 2024 Joint International Conference on Digital Arts, Media and Technology with ECTI Northern Section Conference on Electrical, Electronics, Computer and Telecommunications Engineering (ECTI DAMT & NCON), Chiang-mai, Thailand, 31 January–3 February 2024; pp. 519–524. [Google Scholar] [CrossRef]
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
Kummaraka, U.; Srisuradetchai, P. Time-Series Interval Forecasting with Dual-Output Monte Carlo Dropout: A Case Study on Durian Exports. Forecasting 2024, 6, 616-636. https://doi.org/10.3390/forecast6030033
Kummaraka U, Srisuradetchai P. Time-Series Interval Forecasting with Dual-Output Monte Carlo Dropout: A Case Study on Durian Exports. Forecasting. 2024; 6(3):616-636. https://doi.org/10.3390/forecast6030033
Chicago/Turabian StyleKummaraka, Unyamanee, and Patchanok Srisuradetchai. 2024. "Time-Series Interval Forecasting with Dual-Output Monte Carlo Dropout: A Case Study on Durian Exports" Forecasting 6, no. 3: 616-636. https://doi.org/10.3390/forecast6030033
APA StyleKummaraka, U., & Srisuradetchai, P. (2024). Time-Series Interval Forecasting with Dual-Output Monte Carlo Dropout: A Case Study on Durian Exports. Forecasting, 6(3), 616-636. https://doi.org/10.3390/forecast6030033