Achieving agricultural productivity depends on selecting suitable crop varieties based on soil characteristics and environmental conditions. However, crop selection is complicated by interactions between soil nutrients and environmental factors. This study evaluates a crop recommendation framework based on the CatBoost classifier optimized using Bayesian Optimization. The methodology uses a dataset of 2,200 records containing seven parameters nitrogen (N), phosphorus (P), potassium (K), temperature, humidity, pH, and rainfall across 22 crop classes. The dataset was divided using a stratified 80:20 split into 1,760 training samples and 440 independent testing samples. Bayesian Optimization was conducted using Optuna with a Tree-structured Parzen Estimator sampler over 30 trials, with hyperparameter selection guided by mean accuracy from five-fold stratified cross-validation performed exclusively on the training set. The default and optimized CatBoost models achieved identical testing results: 99.77% accuracy, 99.78% precision, 99.77% recall, and 99.77% F1-score. The optimized model achieved a mean cross-validation accuracy of 99.26%, compared with 98.75% for the default model. Feature importance analysis identified humidity, potassium, and rainfall as the most influential features in the optimized model. These findings indicate that Bayesian Optimization improved the cross-validation score but did not yield a meaningful improvement in independent test performance
Copyrights © 2027