Optimized deep learning and KNN Models with PCA feature selection for forecasting Cowpea yeild in Nigeria

Authors

  • Terfa Benjamin Yecho Author
  • Eli Adama Jiya Author

DOI:

https://doi.org/10.4314/jobasr.v4i2.29

Keywords:

Cowpea Yield Prediction, Machine Learning, Deep Learning, Autoencoder, Feature selection

Abstract

Reliable prediction of crop yield plays a critical role in improving agricultural decision-making and promoting sustainable farming practices. Conventional approaches are often limited in their ability to model the nonlinear relationships that exist among plant growth dynamics. In this study, three machine learning techniques namely; Convolutional Neural Networks (CNN), Long Short-Term Memory (LSTM) networks and K-Nearest Neighbors (KNN) were designed and assessed for their effectiveness in forecasting cowpea (Vigna unguiculata) yield based on data acquired from IoT-enabled sensors, the dataset was obtained from a controlled cultivation experiment, with yield quantified by the number of pods produced per plant. Principal Component Analysis reduced dimensionality while preserving over 95% of the variance. Hyperparameter optimization was performed using GridSearchCV for KNN and Keras Tuner RandomSearch for CNN and LSTM. The optimized achieved the highest predictive accuracy with an R² of 0.8754, MAE of 0.0492, and RMSE of 0.0639, outperforming the optimized LSTM (96 units, additional dense layer of 64 units, RMSprop optimizer; R² = 0.8334) and optimized KNN (n_neighbors = 3; R² = 0.7566). However, both CNN and LSTM showed systematic under-prediction bias at higher yield values, with LSTM exhibiting the largest negative residuals. The findings demonstrate that deep learning approaches, particularly CNN, can effectively model crop yield with relatively small datasets when combined with appropriate feature selection and hyperparameter optimization. The integration of statistical feature selection with agronomic domain knowledge enhances model robustness and biological interpretability. These results support improved decision-making in precision agriculture, enabling more accurate yield forecasting for sustainable cowpea production.

References

Downloads

Published

30.03.2026

Issue

Section

Articles

How to Cite

Benjamin Yecho, T., & Adama Jiya, E. (2026). Optimized deep learning and KNN Models with PCA feature selection for forecasting Cowpea yeild in Nigeria. JOURNAL OF BASICS AND APPLIED SCIENCES RESEARCH, 4(2), 297-306. https://doi.org/10.4314/jobasr.v4i2.29