Views
No views yet
| Metric | Score |
|---|---|
| Macro F1 | 0.892 |
| AUC-ROC | 0.960 |
| Accuracy | 0.986 |
| Precision | 0.775 |
| Recall | 0.809 |
| Model | Macro F1 | AUC-ROC |
|---|---|---|
| LightGBM ✓ | 0.886 ± 0.007 | 0.968 ± 0.006 |
| RandomForest | 0.780 ± 0.024 | 0.971 ± 0.006 |
| XGBoost | 0.732 ± 0.012 | 0.956 ± 0.010 |
| Confusion Matrix | ROC Curves |
|---|---|
![]() | ![]() |
| Feature Importance | Model Comparison |
|---|---|
![]() | ![]() |
| Feature | Description |
|---|---|
| Air temperature [K] | Ambient air temperature |
| Process temperature [K] | Process temperature |
| Rotational speed [rpm] | Machine rotational speed |
| Torque [Nm] | Machine torque |
| Tool wear [min] | Tool wear time |
| Type_encoded | Product quality variant (L=0, M=1, H=2) |
| Feature | Formula | Physical Meaning |
|---|---|---|
| temp_diff | Air temp - Process temp | Temperature differential |
| power_proxy | Torque / (Speed + 1) | Power consumption indicator |
| torque_wear | Torque × Tool wear | Stress accumulation |
| speed_wear | Speed × Tool wear | Rotational stress over time |
| temp_torque | Process temp × Torque | Thermal-mechanical load |
1import pickle
2import numpy as np
3from huggingface_hub import hf_hub_download
4
5# Download model
6model_path = hf_hub_download(
7 repo_id="kushal23/machine-maintenance-predictor",
8 filename="model.pkl"
9)
10
11# Load
12with open(model_path, "rb") as f:
13 pipeline = pickle.load(f)
14
15# Prepare input: [Air temp, Process temp, Speed, Torque, Tool wear,
16# Type_encoded, temp_diff, power_proxy, torque_wear, speed_wear, temp_torque]
17air_temp = 298.1
18proc_temp = 308.6
19speed = 1551
20torque = 42.8
21tool_wear = 0
22type_enc = 1 # L=0, M=1, H=2
23
24sample = np.array([[
25 air_temp, proc_temp, speed, torque, tool_wear, type_enc,
26 air_temp - proc_temp, # temp_diff
27 torque / (speed + 1), # power_proxy
28 torque * tool_wear, # torque_wear
29 speed * tool_wear, # speed_wear
30 proc_temp * torque # temp_torque
31]])
32
33prediction = pipeline.predict(sample)
34probability = pipeline.predict_proba(sample)[:, 1]
35
36print(f"Failure predicted: {'YES ⚠️' if prediction[0] == 1 else 'No ✓'}")
37print(f"Failure probability: {probability[0]:.1%}")| File | Description |
|---|---|
model.pkl | Full sklearn Pipeline (StandardScaler + LightGBM) |
metadata.json | Model metadata, features, and all metrics |
label_encoder.pkl | Product type encoder (L/M/H → 0/1/2) |
confusion_matrix.png | Confusion matrix visualization |
feature_importance.png | Feature importance chart |
model_comparison.png | All models comparison |
roc_curves.png | ROC curves for all models |