Soil Fertility Prediction Model
This machine learning model predicts soil fertility status (e.g. fertile or infertile) based on several chemical soil parameters. It was trained using a Random Forest Classifier on real agricultural data.
🧠 Model Info
Type: Random Forest Classifier
Framework: Scikit-learn
Input: 13 numerical soil features
Output: Fertility classification with confidence score
📥 Input Format
The model expects a list of 13 numeric values in the following order:
[
Nitrogen (N),
Phosphorus (P),
Potassium (K),
Soil Acidity (pH),
Electrical Conductivity (EC),
Organic Carbon (OC),
Sulfur (S),
Zinc (Zn),
Iron (Fe),
Copper (Cu),
Manganese (Mn),
Boron (B)
]
Example:
{
"inputs": [12.0, 5.5, 20.0, 6.7, 1.1, 0.6, 10.0, 1.2, 4.1, 0.4, 3.3, 0.2, 0.5]
}
⚠️ Note: The input must be a JSON object with the key "inputs" and a list of exactly 13 values.
📤 Output Format
The model returns a list with one dictionary containing the predicted label and a confidence score.
Example output:
[
{
"label": "fertile",
"score": 0.92
}
]
📦 Files Included
random_forest_pkl.pkl — The trained model
inference.py — Required for Hugging Face model hub to run inference
requirements.txt — Python dependencies
README.md — This file
📚 Requirements
Python packages needed (also listed in requirements.txt):
scikit-learn
numpy
🔧 Usage
This model can be used via the Hugging Face Inference API once uploaded to the Model Hub.