A Hybrid CNN-LSTM-Attention Deep Learning Model for Optimized Agricultural Weather Forecasting
Keywords:
Agricultural weather prediction, Convolutional Neural Network (CNN), Deep learning, Hybrid deep learning, Long Short-Term Memory (LSTM), Multivariate time series, Time-series forecastingAbstract
Accurate weather forecasting is critical for agricultural planning and resource management, yet traditional numerical models often struggle with the complex, non-linear, and multi-scale temporal patterns inherent in meteorological data. This article proposes a hybrid deep learning architecture that integrates one-dimensional convolutional neural networks, long short-term memory networks, and a self-attention mechanism for optimized agricultural weather forecasting. The model first applies a convolutional layer to extract local temporal motifs from normalized, overlapping multivariate time series, followed by max pooling to reduce dimensionality while preserving salient features. The resulting feature maps are then processed by an LSTM network, which captures long-term dependencies and cyclical trends that exceed the convolutional receptive field. A key novelty of this study approach is the incorporation of a self-attention module directly after the LSTM; this mechanism computes dynamic importance weights for each time step, thereby emphasizing extreme events or abrupt transitions that are particularly impactful for agricultural outcomes. The attended context vector is subsequently passed through a dense layer and a linear output neuron for regression. The entire model is trained end-to-end using the Adam optimizer to minimize mean squared error. This study's contributions include the principled combination of these three components into a single pipeline tailored for weather data and the demonstration that attention weighting significantly improves prediction robustness. This work provides a computationally efficient and interpretable framework for generating high-fidelity forecasts that can directly inform irrigation scheduling, pest management, and harvest timing.
References
Z. Pu and E. Kalnay, “Numerical Weather Prediction Basics: Models, Numerical Methods, and Data Assimilation,” in Handbook of Hydrometeorological Ensemble Forecasting, pp. 67–97, 2019.
P. Chujai, N. Kerdprasop, and K. Kerdprasop, “Time Series Analysis of Household Electric Consumption with ARIMA and ARMA Models,” Proceedings of the International MultiConference Engineers and Computer Scientists (IMECS 2013), vol. 1, pp. 295–300, Mar. 2013.
B. Wolff, J. Kühnert, E. Lorenz, O. Kramer, and D. Heinemann, “Comparing support vector regression for PV power forecasting to a physical modeling approach using measurement, numerical weather prediction, and cloud motion data,” Solar Energy, vol. 135, pp. 197–208, Oct. 2016.
P. Malhotra, L. Vig, G. Shroff, and P. Agarwal, “Long Short Term Memory Networks for Anomaly Detection in Time Series,” in Proc. 23rd European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning (ESANN 2015), pp. 89–94, Apr. 2015.
J. Chung, C. Gulcehre, K. Cho, and Y. Bengio, “Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling,” arXiv preprint arXiv:1412.3555, 2014.
B. Zhao, H. Lu, S. Chen, J. Liu, and D. Wu, “Convolutional Neural Networks for Time Series Classification,” Journal of Systems Engineering and Electronics, vol. 28, no. 1, pp. 162–169, Feb. 2017.
C. Han, H. Park, Y. Kim, and G. Gim, “Hybrid CNN-LSTM Based Time Series Data Prediction Model Study,” in Big Data, Cloud Computing, and Data Science Engineering (BCD 2022), vol. 1075, R. Lee, Ed., pp. 43–54, 2023.
A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, “Attention Is All You Need,” in Advances in Neural Information Processing Systems (NeurIPS), vol. 30, pp. 5998–6008, 2017.
M. A. R. Suleman and S. Shridevi, “Short-Term Weather Forecasting Using Spatial Feature Attention Based LSTM Model,” IEEE Access, vol. 10, pp. 82456–82468, 2022.
A. Graves, “Long Short-Term Memory,” in Supervised Sequence Labelling with Recurrent Neural Networks, Studies in Computational Intelligence, vol. 385, pp. 37–45, 2012.
H. U. Kim and T. S. Bae, “Preliminary Study of Deep Learning-Based Precipitation Prediction,” Journal of the Korean Society of Surveying Geodesy Photogrammetry and Cartography, vol. 35, no. 5, pp. 423–430, Oct. 2017.
J. A. Weyn, D. R. Durran, and R. Caruana, “Improving Data-Driven Global Weather Prediction Using Deep Convolutional Neural Networks on a Cubed Sphere,” Journal of Advances in Modeling Earth Systems, vol. 12, no. 9, Sep. 2020.
S. Xu, W. Li, Y. Zhu, and A. Xu, “A Novel Hybrid Model for Six Main Pollutant Concentrations Forecasting Based on Improved LSTM Neural Networks,” Scientific Reports, vol. 12, no. 1, Aug. 2022.
Y. Qin, D. Song, H. Chen, W. Cheng, G. Jiang, and G. W. Cottrell, “A Dual-Stage Attention-Based Recurrent Neural Network for Time Series Prediction,” Proceedings of the Twenty-Sixth International Joint Conference on Artificial Intelligence, pp. 2627–2633, Aug. 2017.
H. Zheng, F. Lin, X. Feng, and Y. Chen, “A Hybrid Deep Learning Model With Attention-Based Conv-LSTM Networks for Short-Term Traffic Flow Prediction,” IEEE Transactions on Intelligent Transportation Systems, vol. 22, no. 11, pp. 6910–6920, Nov. 2021.
A. Wan, Q. Chang, K. Al-Bukhaiti, and J. He, “Short-Term Power Load Forecasting for Combined Heat and Power Using CNN-LSTM Enhanced by Attention Mechanism,” Energy, vol. 282, Nov. 2023.
T. Xiong, J. He, H. Wang, X. Tang, Z. Shi, and Q. Zeng, “Contextual SA-Attention Convolutional LSTM for Precipitation Nowcasting: A Spatiotemporal Sequence Forecasting View,” IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, vol. 14, pp. 12479–12491, 2021.
A. Romia and Q. Huang, “A Hybrid CNN-LSTM-Attention Deep Learning Model for Forecasting Time-Series Electric Vehicles Fast Charging Loads at Public Stations,” 2024 IEEE Industry Applications Society Annual Meeting (IAS), pp. 1–7, Oct. 2024.
D. P. Kingma and J. Ba, “Adam: A Method for Stochastic Optimization,” arXiv preprint arXiv:1412.6980, 2014.
S. D. Yun and B. M. Gramig, “Agro-Climatic Data by County: A Spatially and Temporally Consistent U.S. Dataset for Agricultural Yields, Weather and Soils,” Data, vol. 4, no. 2, May 2019.
A. Pelosi, G. Aceto, A. Aprile, and G. B. Chirico, “Evaluation of the Performance of the Global Weather Dataset AgERA5 for Sustainable Water Management in Agriculture: A Focus on Reference Evapotranspiration,” in Computational Science and Its Applications – ICCSA 2025 Workshops, Lecture Notes in Computer Science, vol. 15899, O. Gervasi et al., Eds. Cham, Switzerland: Springer, pp. 283–293, 2025.
Kaggle, “Farm Weather Data,” dataset, 2024.
N. Bantilan, “pandera: Statistical Data Validation of Pandas Dataframes,” in Proceedings of the 19th Python in Science Conference (SciPy 2020), M. Agarwal, C. Calloway, D. Niederhut, and D. Shupe, Eds., pp. 116–124, 2020.
Doreswamy, I. Gad and B. R. Manjunatha, "Performance evaluation of predictive models for missing data imputation in weather data," 2017 International Conference on Advances in Computing, Communications and Informatics (ICACCI), Udupi, India, 2017, pp. 1327-1334.
J. Hao and T. K. Ho, “Machine Learning Made Easy: A Review of Scikit-learn Package in Python Programming Language,” Journal of Educational and Behavioral Statistics, vol. 44, no. 3, pp. 348–361, 2019.
O. D. Anderson, “The Box-Jenkins Approach to Time Series Analysis,” RAIRO—Operations Research, vol. 11, no. 1, pp. 3–29, 1977.
G. Abdenova, Z. Kenzhebayeva, and H. Martyniuk, “Building an ARIMA Model for Predicting Time Series in Python,” International Journal of Computing, vol. 24, no. 2, pp. 369–376, Jul. 2025.
S. P. Thirimanne, E. Y. Lemango, G. Antoniol, and M. Nayebi, “One Documentation Does Not Fit All: Case Study of TensorFlow Documentation,” 2025 IEEE 49th Annu. Comput., Softw., Appl. Conf. (COMPSAC), Jul. 2025, pp. 1234–1243.
Wikipedia, MA: Mean absolute error, Wikipedia, 2016.
T. O. Hodson, “Root-Mean-Square Error (RMSE) or Mean Absolute Error (MAE): When to Use Them or Not,” Geoscientific Model Development, vol. 15, no. 14, pp. 5481–5487, Jul. 2022.
A. Di Bucchianico, “Coefficient of Determination (R²),” in Encyclopedia of Statistics in Quality and Reliability, F. Ruggeri, R. S. Kenett, and F. W. Faltin, Eds. Hoboken, NJ, USA: Wiley, 2008.
S. Fort, H. Hu, and B. Lakshminarayanan, “Deep Ensembles: A Loss Landscape Perspective,” arXiv preprint arXiv:1912.02757, 2019.