|
|
--- |
|
|
license: mit |
|
|
language: |
|
|
- en |
|
|
metrics: |
|
|
- accuracy |
|
|
pipeline_tag: tabular-classification |
|
|
tags: |
|
|
- recommendation |
|
|
- classification |
|
|
- crop-recommendation |
|
|
--- |
|
|
|
|
|
# Model Card for Infinitode/CRM-OPEN-ARC |
|
|
|
|
|
Repository: https://github.com/Infinitode/OPEN-ARC/ |
|
|
|
|
|
## Model Description |
|
|
|
|
|
OPEN-ARC-CR is a straightforward XGBClassifier model developed as part of Infinitode's OPEN-ARC initiative. It was trained to recommend crops that will thrive under specific environmental constraints and variables. |
|
|
|
|
|
**Architecture**: |
|
|
|
|
|
- **XGBClassifier**: Default XGB hyperparams |
|
|
- **Framework**: XGBoost |
|
|
- **Training Setup**: Trained with `use_label_encoder=False` and used `eval_metric='mlogloss'`. |
|
|
|
|
|
## Uses |
|
|
|
|
|
- Identifying appropriate crops for specific environmental conditions. |
|
|
- Enhancing crop production by determining optimal environments for growth. |
|
|
- Investigating factors that influence crop yields and those that limit productivity. |
|
|
|
|
|
## Limitations |
|
|
|
|
|
- Potentially generates implausible or inappropriate recommendations when influenced by extreme outlier values. |
|
|
- May provide inaccurate recommendations; exercise caution when relying on these outputs. |
|
|
|
|
|
## Training Data |
|
|
|
|
|
- Dataset: Crop Recommendation Dataset from Kaggle. |
|
|
- Source URL: https://www.kaggle.com/datasets/varshitanalluri/crop-recommendation-dataset |
|
|
- Content: Soil properties, rainfall patterns, and other agricultural metrics, coupled with the recommended crop. |
|
|
- Size: 2200 entries of crop recommendations. |
|
|
- Preprocessing: Label-encoded target `Crop` using `sklearn's LabelEncoder`. |
|
|
|
|
|
## Training Procedure |
|
|
|
|
|
- Metrics: accuracy |
|
|
- Train/Testing Split: 80% train, 20% testing. |
|
|
|
|
|
## Evaluation Results |
|
|
|
|
|
| Metric | Value | |
|
|
| ------ | ----- | |
|
|
| Train Accuracy | not used | |
|
|
| Testing Accuracy | 98.6% | |
|
|
|
|
|
## How to Use |
|
|
|
|
|
```python |
|
|
def test_random_samples(model, X_test, y_test, le, n_samples=6): |
|
|
# Select 6 random indices |
|
|
random_indices = random.sample(range(X_test.shape[0]), n_samples) |
|
|
|
|
|
# Extract the random samples |
|
|
X_sample = X_test.iloc[random_indices, :] |
|
|
y_true_sample = y_test.iloc[random_indices] |
|
|
|
|
|
# Predict crop recommendations |
|
|
y_pred_sample = model.predict(X_sample) |
|
|
|
|
|
# Decode the predictions and ground truth back to crop names |
|
|
crops_pred = le.inverse_transform(y_pred_sample) |
|
|
crops_true = le.inverse_transform(y_true_sample) |
|
|
|
|
|
# Display the results |
|
|
for i in range(n_samples): |
|
|
print(f"Sample {i+1}:") |
|
|
print(f"Features: \n{X_sample.iloc[i]}") |
|
|
print(f"Predicted Crop: {crops_pred[i]}") |
|
|
print(f"Ground Truth: {crops_true[i]}") |
|
|
print("-" * 30) |
|
|
|
|
|
# Test the function with random samples |
|
|
test_random_samples(model, X_test, y_test, le) |
|
|
``` |
|
|
|
|
|
## Contact |
|
|
|
|
|
For questions or issues, open a GitHub issue or reach out at https://infinitode.netlify.app/forms/contact. |