An Explainable Machine Learning Framework for Cybersecurity in Smart Agriculture: Intrusion Detection, XAI, and a Conceptual Generative AI Communication Layer
Abstract
Smart agriculture increasingly depends on Internet of Things (IoT) devices, networked sensors, cloud platforms, and data-driven decision systems. These technologies improve agricultural productivity and monitoring, but they also expand the attack surface of farm cyber-physical systems. This study proposes a benchmark-based explainable machine learning framework for intrusion detection in smart agriculture. The empirical evaluation focuses on the detection and explainability components of the framework, using a consolidated NSL-KDD dataset created by merging CSV-formatted versions corresponding to KDDTrain+.TXT and KDDTest+.TXT and then applying a stratified 80/20 train-test split. After binary target construction, the dataset contains 77,053 normal records and 71,463 attack records. Random Forest and XGBoost models were trained and evaluated for binary intrusion detection. Random Forest achieved an accuracy of 0.9958 and an AUC of 0.9998, while XGBoost achieved an accuracy of 0.9959 and an AUC of 0.9999 under the custom experimental design. SHAP and LIME were used to interpret global feature contributions and local prediction behavior. The strongest signals included traffic-volume variables, service indicators, login-related variables, and host-based traffic statistics. These high values are interpreted cautiously because the study uses a merged and resampled benchmark setting rather than canonical NSL-KDD validation or real agricultural IoT traffic. The generative AI communication component is framed as a future user-centered extension rather than an empirically evaluated contribution. The study contributes a transparent and reproducible benchmark framework that can support future domain-specific validation in smart agriculture cybersecurity.
Keywords
- Smart agriculture
- Agriculture 4.0
- cybersecurity
- intrusion detection
- machine learning
- explainable artificial intelligence
- SHAP
- LIME
- NSL-KDD
Supporting Institution
Ethical Statement
Thanks
References
- Aldhyani, T. H. H., & Alkahtani, H. (2023). Cyber security for detecting distributed denial of service attacks in Agriculture 4.0: Deep learning model. Mathematics, 11(1), Article 233. https://doi.org/10.3390/math11010233
- Barredo Arrieta, A., Diaz-Rodriguez, N., Del Ser, J., Bennetot, A., Tabik, S., Barbado, A., Garcia, S., Gil-Lopez, S., Molina, D., Benjamins, R., Chatila, R., & Herrera, F. (2020). Explainable artificial intelligence (XAI): Concepts, taxonomies, opportunities and challenges. Information Fusion, 58, 82-115. https://doi.org/10.1016/j.inffus.2019.12.012
- Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5-32. https://doi.org/10.1023/A:1010933404324
- Chen, T., & Guestrin, C. (2016). XGBoost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (pp. 785-794). https://doi.org/10.1145/2939672.2939785
- Cybersecurity and Infrastructure Security Agency. (n.d.-a). Food and agriculture sector. U.S. Department of Homeland Security. Retrieved April 1, 2026, from https://www.cisa.gov/topics/critical-infrastructure-security-and-resilience/critical-infrastructure-sectors/food-and-agriculture-sector
- Cybersecurity and Infrastructure Security Agency. (n.d.-b). Food and agriculture cybersecurity checklist and resources. U.S. Department of Homeland Security. Retrieved April 1, 2026, from https://www.cisa.gov/resources-tools/resources/food-and-agriculture-cybersecurity-checklist-and-resources
- Demestichas, K., Peppes, N., Alexakis, T., & Adamopoulou, E. (2020). Survey on security threats in agricultural IoT and smart farming. Sensors, 20(22), Article 6458. https://doi.org/10.3390/s20226458
- Dhanabal, L., & Shantharajah, S. P. (2015). A study on NSL-KDD dataset for intrusion detection system based on classification algorithms. International Journal of Advanced Research in Computer and Communication Engineering, 4(6), 446-452.
Details
Primary Language
English
Subjects
Supervised Learning, Natural Language Processing
Journal Section
Research Article
Authors
Shanzhen Gao
0000-0002-3856-2530
United States
Weizheng Gao
*
0009-0003-5078-6283
United States
Ephrem Eyob
This is me
0000-0003-3590-0028
United States
Ju Hyeong Jin
This is me
0000-0002-6653-7383
United States
Publication Date
July 22, 2026
Submission Date
May 13, 2026
Acceptance Date
July 14, 2026
Published in Issue
Year 2026 Number: 10