Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- sklearn
|
| 5 |
+
- predictive-maintenance
|
| 6 |
+
- classification
|
| 7 |
+
- adaboost
|
| 8 |
+
datasets:
|
| 9 |
+
- jskswamy/predictive-maintenance-data
|
| 10 |
+
metrics:
|
| 11 |
+
- f2
|
| 12 |
+
- recall
|
| 13 |
+
- accuracy
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Predictive Maintenance Model
|
| 17 |
+
|
| 18 |
+
## Model Description
|
| 19 |
+
|
| 20 |
+
This AdaBoost classifier predicts whether a diesel engine requires maintenance based on sensor readings.
|
| 21 |
+
The model was trained for **commercial fleet predictive maintenance** applications.
|
| 22 |
+
|
| 23 |
+
## Primary Metric: F2 Score
|
| 24 |
+
|
| 25 |
+
The model is optimized for **F2 Score** (recall weighted 2x over precision) because in predictive maintenance:
|
| 26 |
+
- Missing a maintenance need (False Negative) leads to costly breakdowns
|
| 27 |
+
- A false alarm (False Positive) only results in an extra inspection
|
| 28 |
+
|
| 29 |
+
## Performance Metrics
|
| 30 |
+
|
| 31 |
+
| Metric | Value |
|
| 32 |
+
|--------|-------|
|
| 33 |
+
| **F2 Score** | **0.8860** |
|
| 34 |
+
| Recall | 0.9752 |
|
| 35 |
+
| Precision | 0.6485 |
|
| 36 |
+
| F1 Score | 0.7790 |
|
| 37 |
+
| Accuracy | 0.6511 |
|
| 38 |
+
| ROC-AUC | 0.6762 |
|
| 39 |
+
|
| 40 |
+
## Features
|
| 41 |
+
|
| 42 |
+
The model uses 6 engine sensor readings:
|
| 43 |
+
1. Engine RPM
|
| 44 |
+
2. Lub Oil Pressure
|
| 45 |
+
3. Fuel Pressure
|
| 46 |
+
4. Coolant Pressure
|
| 47 |
+
5. Lub Oil Temp
|
| 48 |
+
6. Coolant Temp
|
| 49 |
+
|
| 50 |
+
## Usage
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
import joblib
|
| 54 |
+
import pandas as pd
|
| 55 |
+
from huggingface_hub import hf_hub_download
|
| 56 |
+
|
| 57 |
+
# Download model
|
| 58 |
+
model_path = hf_hub_download(
|
| 59 |
+
repo_id="jskswamy/predictive-maintenance-model",
|
| 60 |
+
filename="best_model.joblib"
|
| 61 |
+
)
|
| 62 |
+
model = joblib.load(model_path)
|
| 63 |
+
|
| 64 |
+
# Prepare input data (6 features)
|
| 65 |
+
X_new = pd.DataFrame({
|
| 66 |
+
'Engine RPM': [800],
|
| 67 |
+
'Lub Oil Pressure': [3.5],
|
| 68 |
+
'Fuel Pressure': [6.0],
|
| 69 |
+
'Coolant Pressure': [2.5],
|
| 70 |
+
'Lub Oil Temp': [78],
|
| 71 |
+
'Coolant Temp': [80]
|
| 72 |
+
})
|
| 73 |
+
|
| 74 |
+
# Predict
|
| 75 |
+
prediction = model.predict(X_new)
|
| 76 |
+
probability = model.predict_proba(X_new)[:, 1]
|
| 77 |
+
|
| 78 |
+
print(f"Prediction: {'Normal' if prediction[0] == 0 else 'Maintenance Required'}")
|
| 79 |
+
print(f"Maintenance Probability: {probability[0]:.2%}")
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## Training Details
|
| 83 |
+
|
| 84 |
+
- **Algorithm:** AdaBoost
|
| 85 |
+
- **Hyperparameter Tuning:** GridSearchCV with 5-fold stratified CV
|
| 86 |
+
- **Scoring:** F2 Score (beta=2)
|
| 87 |
+
- **Training Data:** 15,628 samples
|
| 88 |
+
- **Test Data:** 3,907 samples
|
| 89 |
+
|
| 90 |
+
## License
|
| 91 |
+
|
| 92 |
+
MIT License
|