

🌱 AI-Based Crop Recommendation System | Machine Learning Project
I’m pleased to share my internship project: “AI-Based Crop Recommendation System — A Machine Learning Approach for Bihar’s Agro-Climatic Conditions.”
The objective of this project was to build an ML-based system that recommends suitable crops using soil and climatic conditions.
🌾 Input & Prediction
The model uses 7 parameters:
• Nitrogen (N)
• Phosphorus (P)
• Potassium (K)
• Temperature
• Humidity
• Soil pH
• Rainfall
It predicts among 8 crops: Rice, Wheat, Maize, Lentil, Mustard, Sugarcane, Jute and Potato.
The "recommend()" function provides the Top-3 crop recommendations with model confidence values.
📊 Dataset & Methodology
I created a simulated dataset of 3,200 records, with 400 samples per crop.
The data was divided into 80% training (2,560) and 20% testing (640) using a stratified split.
I compared six classification algorithms:
Logistic Regression, KNN, SVM, Decision Tree, Random Forest and Gradient Boosting.
For preprocessing, I used StandardScaler inside a Pipeline to avoid data leakage.
Model selection was performed using Stratified 5-Fold Cross-Validation, followed by hyperparameter tuning with GridSearchCV.
🤖 Best Model & Results
SVM with an RBF kernel achieved the highest cross-validation performance:
CV Accuracy: 93.52% ± 0.79%
After tuning, the final model achieved on the untouched test set:
🎯 Accuracy: 93.12%
📌 Macro F1: 93.13%
🔥 Top-3 Accuracy: 100%
I also performed error analysis. Out of 44 misclassified test samples, 26 involved confusion between Jute and Rice, which showed where the model had difficulty distinguishing overlapping simulated conditions.
I further explored permutation importance and feature ablation to understand the contribution of different features.
🎓 What I Learned
This project taught me that building an ML model is not just about achieving high accuracy. I learned how to prepare reproducible data, apply preprocessing correctly, compare multiple algorithms, and use cross-validation and hyperparameter tuning for model selection. Error analysis, feature importance and ablation studies helped me understand why the model performs the way it does, rather than looking only at the final accuracy. Most importantly, I learned to evaluate the data quality, methodology and limitations before interpreting an ML result.
⚠️ Important Note
The dataset used in this project is simulated, not collected from real farms. Therefore, the 93.12% accuracy demonstrates the model's performance on the simulated dataset and should not be interpreted as real-world agricultural accuracy.
This project gave me practical exposure to the complete ML workflow — from data preparation and preprocessing to model selection, evaluation, error analysis and prediction.
#ArtificialIntelligence #MachineLearning #Python #DataScience #AgriTech #AI #ML #Internship #CropRecommendation #ScikitLearn #SVM #GECGopalganj
20 September 2026 à 02h13
View on LinkedIn →