Skip to content

About

Predictive Modeling for Agriculture

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Precision Agriculture: Predictive Crop Classification 🌿

📌 Project Overview

Soil analysis is critical for maximizing agricultural yield, yet measuring every metric (Nitrogen, Phosphorous, Potassium, and pH) can be costly for farmers. This project applies Machine Learning to help farmers identify the optimal crop for their land based on specific soil conditions.

The primary goal is to build a multi-class classification model and determine which single soil metric is the most predictive for choosing the right crop.


📊 Dataset: soil_measures.csv

The dataset contains measurements from various fields, where each row represents the ideal soil conditions for a specific crop.

Metric Description
N Nitrogen content ratio in the soil
P Phosphorous content ratio in the soil
K Potassium content ratio in the soil
pH The acidity or alkalinity of the soil
crop The target variable (e.g., wheat, rice, maize, etc.)

⚙️ Technical Workflow

1. Data Exploration & Preparation

  • Checked for missing values and analyzed the unique categories in the crop target variable.
  • Split the data into Training (80%) and Testing (20%) sets to ensure unbiased evaluation.

2. Feature Importance Analysis

Instead of using all features at once, this project evaluates the predictive power of each soil metric individually:

  • Model: Logistic Regression (using the multinomial setting for multi-class support).
  • Process: A loop was used to train a unique model for each feature (N, P, K, and pH).

3. Evaluation Metric

The F1-Score (weighted) was chosen as the primary metric. Since the goal is to find the most reliable individual predictor, the F1-score provides a better balance between precision and recall than simple accuracy, especially if crop classes are slightly imbalanced.


📈 Results

After evaluating each feature, the results identified the following:

  • Best Predictive Feature: Potassium (K)
  • Performance: Potassium yielded the highest F1-score, suggesting it is the most critical individual indicator for determining crop type in this dataset.

🚀 Installation & Usage

  1. Clone the repository:
    git clone [https://github.com/YOUR_USERNAME/crop-classification.git](https://github.com/YOUR_USERNAME/crop-classification.git)

About

Predictive Modeling for Agriculture

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages