Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,116 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
metrics:
|
| 6 |
+
- accuracy
|
| 7 |
+
- precision
|
| 8 |
+
- recall
|
| 9 |
+
- f1
|
| 10 |
+
pipeline_tag: tabular-classification
|
| 11 |
+
tags:
|
| 12 |
+
- classification
|
| 13 |
+
- crop-health
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Model Card for Infinitode/PSPM-OPEN-ARC
|
| 17 |
+
|
| 18 |
+
Repository: https://github.com/Infinitode/OPEN-ARC/
|
| 19 |
+
|
| 20 |
+
## Model Description
|
| 21 |
+
|
| 22 |
+
OPEN-ARC-PSP is a straightforward XGBClassifier model developed as part of Infinitode's OPEN-ARC initiative. It was designed to potentially identify plants experiencing high stress caused by external factors.
|
| 23 |
+
|
| 24 |
+
**Architecture**:
|
| 25 |
+
|
| 26 |
+
- **XGBClassifier**: `n_estimators=100`, `learning_rate=0.1`, `max_depth=6`, `subsample=0.8`, `colsample_bytree=0.8`, `random_state=42`.
|
| 27 |
+
- **Framework**: XGBoost
|
| 28 |
+
- **Training Setup**: Trained with the default training params.
|
| 29 |
+
|
| 30 |
+
## Uses
|
| 31 |
+
|
| 32 |
+
- Identifying crops experiencing significant stress.
|
| 33 |
+
- Improving crop production by mitigating major stressors affecting plants.
|
| 34 |
+
- Performing experimental studies on plant behavior and yield outcomes influenced by stress levels.
|
| 35 |
+
|
| 36 |
+
## Limitations
|
| 37 |
+
|
| 38 |
+
- May generate implausible or inappropriate results when influenced by extreme outlier values.
|
| 39 |
+
- Could provide inaccurate plant stress levels; caution is advised when relying on these outputs.
|
| 40 |
+
|
| 41 |
+
## Training Data
|
| 42 |
+
|
| 43 |
+
- Dataset: Plant-Health-Data dataset from Kaggle.
|
| 44 |
+
- Source URL: https://www.kaggle.com/datasets/ziya07/plant-health-data
|
| 45 |
+
- Content: Soil characteristics, moisture levels, and various agricultural metrics, combined with the anticipated stress level of the plant.
|
| 46 |
+
- Size: 1200 entries of plant stress levels.
|
| 47 |
+
- Preprocessing: Dropped unnecessary features like the `Timestamp` and `Plant_ID`. Stress levels were manually mapped to three distinct numerical values.
|
| 48 |
+
|
| 49 |
+
## Training Procedure
|
| 50 |
+
|
| 51 |
+
- Metrics: accuracy, precision, recall, F1
|
| 52 |
+
- Train/Testing Split: 80% train, 20% testing.
|
| 53 |
+
|
| 54 |
+
## Evaluation Results
|
| 55 |
+
|
| 56 |
+
| Metric | Value |
|
| 57 |
+
| ------ | ----- |
|
| 58 |
+
| Testing Accuracy | 99.1% |
|
| 59 |
+
| Testing Weighted Average Precision | 99% |
|
| 60 |
+
| Testing Weighted Average Recall | 99% |
|
| 61 |
+
| Testing Weighted Average F1 | 99% |
|
| 62 |
+
|
| 63 |
+
## How to Use
|
| 64 |
+
|
| 65 |
+
```python
|
| 66 |
+
import random
|
| 67 |
+
|
| 68 |
+
def test_random_samples(model, X_test, y_test, n_samples=5):
|
| 69 |
+
"""
|
| 70 |
+
Selects random samples from the test set, makes predictions, and compares with actual values.
|
| 71 |
+
|
| 72 |
+
Parameters:
|
| 73 |
+
- model: Trained XGBoost classifier.
|
| 74 |
+
- X_test: Feature set for testing.
|
| 75 |
+
- y_test: True labels for testing.
|
| 76 |
+
- n_samples: Number of random samples to test.
|
| 77 |
+
|
| 78 |
+
Returns:
|
| 79 |
+
None
|
| 80 |
+
"""
|
| 81 |
+
# Convert X_test and y_test to DataFrame for easier indexing
|
| 82 |
+
X_test_df = X_test.reset_index(drop=True)
|
| 83 |
+
y_test_df = y_test.reset_index(drop=True)
|
| 84 |
+
|
| 85 |
+
# Pick random indices
|
| 86 |
+
random_indices = random.sample(range(len(X_test)), n_samples)
|
| 87 |
+
|
| 88 |
+
print("Testing on Random Samples:")
|
| 89 |
+
for idx in random_indices:
|
| 90 |
+
sample = X_test_df.iloc[idx]
|
| 91 |
+
true_label = y_test_df.iloc[idx]
|
| 92 |
+
|
| 93 |
+
# Predict using the model
|
| 94 |
+
prediction = model.predict(sample.values.reshape(1, -1))
|
| 95 |
+
|
| 96 |
+
# Reverse the health mapping
|
| 97 |
+
reverse_health_mapping = {v: k for k, v in health_mapping.items()}
|
| 98 |
+
|
| 99 |
+
# Map true and predicted labels
|
| 100 |
+
true_label_description = reverse_health_mapping[true_label]
|
| 101 |
+
predicted_label_description = reverse_health_mapping[prediction[0]]
|
| 102 |
+
|
| 103 |
+
# Output results
|
| 104 |
+
print(f"Sample Index: {idx}")
|
| 105 |
+
print(f"Features: {sample.values}")
|
| 106 |
+
print(f"True Label: {true_label}, Predicted Label: {prediction[0]}")
|
| 107 |
+
print(f"True Label (Description): {true_label_description}, Predicted Label (Description): {predicted_label_description}")
|
| 108 |
+
print("-" * 40)
|
| 109 |
+
|
| 110 |
+
# Example usage
|
| 111 |
+
test_random_samples(xgb, X_test, y_test)
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
## Contact
|
| 115 |
+
|
| 116 |
+
For questions or issues, open a GitHub issue or reach out at https://infinitode.netlify.app/forms/contact.
|