Built for farmers who want a clear answer and for engineers who want to understand exactly how that answer was produced.
Crop selection in India is still largely driven by tradition and word-of-mouth. A farmer who picks the wrong crop for a given district and season can lose an entire season's income. We set out to build a system that turns decades of historical agricultural records into a single, actionable recommendation.
Three public datasets were collected, cleaned, and merged to build the training set:
After merging on state, district, crop, and season keys, records with missing production or price data were dropped. Average yield (production / area) and expected revenue per hectare were derived as target-adjacent features.
What it does: Given a district, state, season, area, rainfall, and historical yield, it predicts the single most profitable crop to grow.
Architecture: A two-layer stacking classifier. The base layer consists of three independently trained models — Random Forest, Gradient Boosting Classifier, and AdaBoost — each producing probability estimates across all crop classes. These out-of-fold predictions are fed as features to a Logistic Regression meta-learner, which produces the final class output. Stacking was chosen over a single model because each base learner captures different non-linear patterns, and the meta-learner learns how to weight them optimally.
Inputs: State, district (label-encoded), season (label-encoded), land area, average rainfall, average historical yield.
What it does: Predicts expected revenue per hectare for the recommended crop in a given district and season.
Architecture: A Gradient Boosting Regressor trained on historical revenue per hectare, calculated from production records and market prices. The model captures non-linear interactions between district, season, crop type, and yield history. The app applies a ±20% band around the point estimate to reflect realistic market price volatility — the actual range users see is not random; it reflects the empirical variance in crop prices observed in the training data.
The interactive map is built on Leaflet.js using a district-level GeoJSON of India. Each district polygon is pre-annotated server-side with its nearest matching model district, resolved by string similarity against the training set's district vocabulary. Districts not in the training set fall back to the geographically nearest supported district. You can see exactly which district's data was used in the location strip above the form.
Pick from the map or type a district manually
Click the map to auto-fill, or type a model district name.
ML model output for your selected region