Analysis of NGBoost and XGBoost for Added Amount Fertilizer (NPK) Prediction: Uncertainty Estimation and Model Performance in Precision Agriculture
DOI:
https://doi.org/10.58915/aset.v4i2.2706Keywords:
Fertilizer prediction, XGBoost, NGBoost, Precision agriculture, Soil nutrientsAbstract
Optimizing fertilizer application is essential for enhancing crop yield and minimizing the environmental impact of precision agriculture. This study presents a comparative analysis of XGBoost and NGBoost for predicting the amount of NPK fertilizer added, focusing on model performance and uncertainty estimation. The dataset collected from the Harumanis mango orchards included key soil parameters, such as nitrogen, phosphorus, potassium, pH, EC, soil moisture, temperature, and rainfall. The methodology involved data preprocessing, feature scaling, and model training using XGBoost and NGBoost. XGBoost, a gradient boosting model, provides highly accurate deterministic predictions, whereas NGBoost, a probabilistic model, quantifies the uncertainty in the predictions. Model performance was evaluated using R², MAE, RMSE, and Negative Log-Likelihood (NLL). The results indicate that XGBoost outperforms NGBoost in accuracy, achieving R² = 0.9984, MAE = 2.0388, and RMSE = 2.7618, whereas NGBoost provides uncertainty estimation but with slightly lower accuracy (R² = 0.9909, MAE = 4.9620, RMSE = 6.5654, and NLL = 2.6001). Further analysis included residual plots, prediction error plots, learning curves, and validation curves to assess the reliability and generalization of the models. These findings suggest that, while XGBoost is ideal for deterministic NPK prediction, NGBoost offers probabilistic insights that aid in the development of risk-aware fertilization strategies. This study contributes to data-driven precision agriculture by enhancing fertilizer management efficiency and sustainability.
References
[1] Hedley, C. The role of precision agriculture for improved nutrient management on farms. Journal of the Science of Food and Agriculture, vol. 95, issue 1 (2014), pp. 12–19.
https://doi.org/10.1002/jsfa.6734
[2] Karunathilake, E. M. B. M., Heo, S., Chung, Y. S., Mansoor, S., and Le, A. T. The path to smart farming: innovations and opportunities in precision agriculture. Agriculture, vol. 13, issue 8 (2023), p. 1593. https://doi.org/10.3390/agriculture13081593
[3] Xing, Y., and Wang, X. Precise application of water and fertilizer to crops: challenges and opportunities. Frontiers in Plant Science, vol. 15 (2024), p. 1444560.
https://doi.org/10.3389/fpls.2024.1444560
[4] Shrestha, M. M., and Wei, L. Review—Perspectives on the roles of real-time nitrogen sensing and IoT integration in smart agriculture. Journal of The Electrochemical Society, vol. 171, issue 2 (2024), p. 027526. https://doi.org/10.1149/1945-7111/ad22d8
[5] Garg, S., Rumjit, N. P., and Roy, S. Smart agriculture and nanotechnology: technology, challenges, and new perspectives. Advanced Agrochem, vol. 3, issue 2 (2023), pp. 115–125. https://doi.org/10.1016/j.aac.2023.11.001
[6] Soussi, A., Trinchero, D., Fossa, M., Sacile, R., and Zero, E. Smart sensors and smart data for precision agriculture: a review. Sensors, vol. 24, issue 8 (2024), p. 2647.
https://doi.org/10.3390/s24082647
[7] Graf, R., Zhu, S., and Kolerski, T. Predicting ice phenomena in a river using the artificial neural network and extreme gradient boosting. Resources, vol. 11, issue 2 (2022), p. 12. https://doi.org/10.3390/resources11020012
[8] Díaz, E., and Spagnoli, G. Natural gradient boosting for probabilistic prediction of soaked CBR values using an explainable artificial intelligence approach. Buildings, vol. 14, issue 2 (2024), p. 352. https://doi.org/10.3390/buildings14020352
[9] Chen, S.-Z., Feng, D.-C., Taciroglu, E., and Wang, W.-J. Probabilistic machine-learning methods for performance prediction of structures and infrastructures through natural gradient boosting. Journal of Structural Engineering, vol. 148, issue 8 (2022), p. 04022088. https://doi.org/10.1061/(ASCE)ST.1943-541X.0003401
[10] Nguyen, D. H., Heo, J.-Y., Hien Le, X., and Bae, D.-H. Development of an extreme gradient boosting model integrated with evolutionary algorithms for hourly water level prediction. IEEE Access, vol. 9 (2021), pp. 125853–125867. https://doi.org/10.1109/ACCESS.2021.3111287
[11] Ahmad, M., Sabri, M. M., Jamil, I., Kashyzadeh, K. R., Alguno, A. C., Keawsawasvong, S., and Al-Mansob, R. A. Extreme gradient boosting algorithm for predicting shear strengths of rockfill materials. Complexity, vol. 2022 (2022), pp. 1–11. https://doi.org/10.1155/2022/9415863
[12] Ahmad, I., Bibi, F., Ullah, H., and Munir, T. M. Mango fruit yield and critical quality parameters respond to foliar and soil applications of zinc and boron. Plants, vol. 7, issue 4 (2018), p. 97. https://doi.org/10.3390/plants7040097
[13] Yu, L., Zhou, R., Chen, R., and Lai, K. K. Missing data preprocessing in credit classification: one-hot encoding or imputation? Emerging Markets Finance and Trade, vol. 58, issue 2 (2020), pp. 472–482. https://doi.org/10.1080/1540496X.2020.1825935
[14] Sujon, K. M., Choi, K., Abdus Samad, M., Towshi, Z. T., Hassan, R. B., and Othman, M. A. When to use standardization and normalization: empirical evidence from machine learning models and XAI. IEEE Access, vol. 12 (2024), pp. 135300–135314. https://doi.org/10.1109/ACCESS.2024.3462434
[15] Abiodun, E. O., Alabdulatif, A., Abiodun, O. I., Alawida, M., and Alkhawaldeh, R. S. A systematic review of emerging feature selection optimization methods for optimal text classification: the present state and prospective opportunities. Neural Computing & Applications, vol. 33, issue 22 (2021), pp. 15091–15118. https://doi.org/10.1007/s00521-021-06406-8
[16] Eskandarinasab, M., Hamdi, S. M., and Filali Boubrahimi, S. Impacts of data preprocessing and sampling techniques on solar flare prediction from multivariate time series data of photospheric magnetic field parameters. The Astrophysical Journal Supplement Series, vol. 275, issue 1 (2024), p. 6. https://doi.org/10.3847/1538-4365/ad7c4a
[17] Kulanuwat, L., Chantrapornchai, C., Maleewong, M., Boonya-Aroonnet, S., Wimala, S., Sarinnapakorn, K., and Wongchaisuwat, P. Anomaly detection using a sliding window technique and data imputation with machine learning for hydrological time series. Water, vol. 13, issue 13 (2021), p. 1862. https://doi.org/10.3390/w13131862
[18] Toselli, M., Baldi, E., Ferro, F., Rossi, S., and Cillis, D. Smart farming tool for monitoring nutrients in soil and plants for precise fertilization. Horticulturae, vol. 9, issue 9 (2023), p. 1011. https://doi.org/10.3390/horticulturae9091011
[19] Lu, W., Hao, Z., Lin, M., Fan, X., Gao, J., Li, J., Zhou, Y., Guo, J., and Ma, X. Effects of different proportions of organic fertilizer replacing chemical fertilizer on soil nutrients and fertilizer utilization in gray desert soil. Agronomy, vol. 14, issue 1 (2024), p. 228.
https://doi.org/10.3390/agronomy14010228
[20] Reza, M. N., Lee, K.-H., Karim, M. R., Haque, M. A., Bicamumakuba, E., Dey, P. K., Jang, Y. Y., and Chung, S.-O. Trends of soil and solution nutrient sensing for open field and hydroponic cultivation in facilitated smart agriculture. Sensors (Basel, Switzerland), vol. 25, issue 2 (2025), p. 453. https://doi.org/10.3390/s25020453
[21] Agrahari, R. K., Kobayashi, Y., Tanaka, T. S. T., Panda, S. K., and Koyama, H. Smart fertilizer management: the progress of imaging technologies and possible implementation of plant biomarkers in agriculture. Soil Science and Plant Nutrition, vol. 67, issue 3 (2021), pp. 248–258. https://doi.org/10.1080/00380768.2021.1897479
[22] Arora, P., Singh, R., and Patel, S. Probabilistic modeling for nutrient variability analysis in precision agriculture using ensemble learning. Computers and Electronics in Agriculture, vol. 213 (2024), p. 108091.
[23] Ma, J., Zhang, Y., and Liu, T. Integration of uncertainty-aware deep learning models for soil nutrient prediction under varying environmental conditions. Sustainability, vol. 17, issue 4 (2025), p. 2330.




