Project Overview

A machine learning project to predict suitable crops based on soil characteristics while reducing the number of required soil measurements.

Dataset

  • 2,200 observations.
  • 22 balanced crop classes.
  • Four soil features: nitrogen, phosphorus, potassium and pH.
  • No missing values.

Methodology

  • Exploratory data analysis.
  • Stratified training and test split.
  • Feature selection using cross-validation and correlation analysis.
  • Feature standardisation.
  • Multiclass logistic regression.
  • Hyperparameter optimisation using GridSearchCV.

Correlation Analysis

Correlation Heatmap

Phosphorus was excluded due to its strong correlation with potassium and lower individual predictive performance.

Results

Metric Value
Cross-validation F1 score 0.5987
Test F1 score 0.6009
Relative improvement after tuning 20.2%

The reported test performance is exploratory because the test set was examined during model development.

Confusion Matrix

Confusion Matrix

Technologies

Python, Pandas, Scikit-learn, Matplotlib, Seaborn and Jupyter Notebook.

GitHub Repository

View source code on GitHub

Updated: