How chen729689ougk/industrial-predictive-maintenance works
This is an end-to-end industrial predictive-maintenance project: it explores machine-failure data, trains and evaluates classifiers, tunes decision thresholds to favor recall, explains predictions with SHAP, and serves failure-risk predictions through FastAPI. The production API loads the exported HistGradientBoosting pipeline and its threshold, then returns a probability, classification, and risk message. The dataset itself is referenced by the code and README but is absent from the supplied tree. Some analysis scripts are represented by their documented capabilities; their internal wiring was not sampled.
Main entry points: api.py FastAPI prediction API · export_hgb_model.py HGB model export · optimize_threshold.py Threshold optimization · train_model.py Initial training
Components 18
Data exploration
- Dataset inspection
src/inspect_data.py - Exploratory analysis
notebooks/01_exploratory_data_analysis.ipynb
Model development
- Initial training
src/train_model.py - Model comparison
src/compare_models.py - Threshold comparison
src/compare_treshold.py - Threshold optimization
src/optimize_threshold.py - HGB model export
src/export_hgb_model.py - Initial model artifact
models/predictive_maintenance_pipeline.joblib - Initial threshold
models/decision_threshold.json
Assessment and explanations
- Fair model evaluation
src/evaluate_model_fairly.py - Final evaluation
src/evaluate_final_model.py - Global SHAP analysis
src/explain_model.py - Local SHAP analysis
src/explain_local_prediction.py
Prediction service
- Production HGB model
models/predictive_maintenance_hgb_pipeline.joblib - Production threshold
models/decision_threshold_hgb.json - FastAPI prediction API
src/api.py
Other components
- AI4I dataset
- API consumer
Connections 20
- AI4I dataset → Dataset inspection: reads data
src/inspect_data.py - AI4I dataset → Exploratory analysis: analyzes data
README.md - AI4I dataset → Initial training: trains on
src/train_model.py - AI4I dataset → Model comparison: compares on
src/compare_models.py - AI4I dataset → Threshold comparison: compares on
src/compare_treshold.py - AI4I dataset → Threshold optimization: optimizes on
src/optimize_threshold.py - AI4I dataset → Fair model evaluation: evaluates on
src/evaluate_model_fairly.py - AI4I dataset → Final evaluation: evaluates on
src/evaluate_final_model.py - AI4I dataset → Global SHAP analysis: explains data
src/explain_model.py - AI4I dataset → Local SHAP analysis: selects case
src/explain_local_prediction.py - Initial training → Initial model artifact: saves model
src/train_model.py - Threshold optimization → Initial model artifact: saves model
src/optimize_threshold.py - Threshold optimization → Initial threshold: saves threshold
src/optimize_threshold.py - HGB model export → AI4I dataset: reads data
src/export_hgb_model.py - HGB model export → Production HGB model: exports model
src/export_hgb_model.py - HGB model export → Production threshold: exports threshold
src/export_hgb_model.py - FastAPI prediction API → Production HGB model: loads model
src/api.py - FastAPI prediction API → Production threshold: loads threshold
src/api.py - API consumer → FastAPI prediction API: submits measurements
README.md - FastAPI prediction API → API consumer: returns risk
src/api.py