Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,91 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
# 🍇 Grape Firmness AutoML Model
|
| 5 |
+
|
| 6 |
+
## Model Details
|
| 7 |
+
- **Model type**: RandomForest Regressor (selected by AutoML search)
|
| 8 |
+
- **Framework**: scikit-learn
|
| 9 |
+
- **Preprocessing**: Custom feature engineering and scaling (`preprocess.joblib`)
|
| 10 |
+
- **Files**:
|
| 11 |
+
- `model.joblib` — trained RandomForest model
|
| 12 |
+
- `preprocess.joblib` — preprocessing pipeline (feature transforms)
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
## Task
|
| 17 |
+
**Regression**: Predict grape firmness (continuous value) from structured features.
|
| 18 |
+
This task is designed to explore *Classical AutoML* approaches for tabular datasets.
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
## Dataset
|
| 23 |
+
- **Source**: [rlogh/grape-firmness-dataset](https://huggingface.co/datasets/rlogh/grape-firmness-dataset)
|
| 24 |
+
- **Samples**: ~X rows, Y features (replace with actual numbers if needed)
|
| 25 |
+
- **Split**: 70% train, 15% validation, 15% test
|
| 26 |
+
- **Target**: `firmness` (numerical label)
|
| 27 |
+
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
## Training Procedure
|
| 31 |
+
- **AutoML approach**: grid search across models (RandomForest, SVR, etc.)
|
| 32 |
+
- **Search space**:
|
| 33 |
+
- `RandomForestRegressor` — tuned `n_estimators`, `max_depth`
|
| 34 |
+
- `SVR` — tuned `C`, `kernel`
|
| 35 |
+
- **Evaluation metric**: R² score (maximize)
|
| 36 |
+
- **Validation**: stratified split for regression
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
## Results
|
| 41 |
+
On the **held-out test set**:
|
| 42 |
+
- **RMSE**: 0.177
|
| 43 |
+
- **R²**: 0.943
|
| 44 |
+
|
| 45 |
+
The RandomForest Regressor achieved the best performance.
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
## Limitations
|
| 50 |
+
- **Small dataset size** → may not generalize to unseen grape varieties or measurement settings.
|
| 51 |
+
- **Not production-ready** → purely academic demonstration.
|
| 52 |
+
- **Feature engineering is minimal** → no domain knowledge incorporated.
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## How to Use
|
| 57 |
+
|
| 58 |
+
### Install requirements
|
| 59 |
+
```bash
|
| 60 |
+
pip install scikit-learn joblib
|
| 61 |
+
import joblib
|
| 62 |
+
import numpy as np
|
| 63 |
+
|
| 64 |
+
# Load preprocess and model
|
| 65 |
+
preprocess = joblib.load("preprocess.joblib")
|
| 66 |
+
model = joblib.load("model.joblib")
|
| 67 |
+
|
| 68 |
+
# Example input: replace with real sample (shape must match training features)
|
| 69 |
+
X_new = np.array([[5.1, 3.5, 1.4, 0.2]]) # dummy
|
| 70 |
+
X_new_p = preprocess.transform(X_new)
|
| 71 |
+
|
| 72 |
+
# Predict firmness
|
| 73 |
+
y_pred = model.predict(X_new_p)
|
| 74 |
+
print("Predicted firmness:", y_pred)
|
| 75 |
+
|
| 76 |
+
## Dependencies
|
| 77 |
+
|
| 78 |
+
numpy==1.26.4
|
| 79 |
+
|
| 80 |
+
scikit-learn==1.4.2
|
| 81 |
+
|
| 82 |
+
pandas==2.2.2
|
| 83 |
+
|
| 84 |
+
joblib
|
| 85 |
+
|
| 86 |
+
@dataset{rlogh_grape_firmness_2024,
|
| 87 |
+
title={Grape Firmness Dataset},
|
| 88 |
+
author={rlogh},
|
| 89 |
+
year={2024},
|
| 90 |
+
url={https://huggingface.co/datasets/rlogh/grape-firmness-dataset}
|
| 91 |
+
}
|