π Detects engine failure 122 cycles early with explainable AI β deployed as a production-grade Streamlit dashboard.
Real-time monitoring of engine health indicators and anomaly detection outputs.
Heatmap visualization explaining which sensors contributed most to detected anomalies.
| Engine Status Panel | XAI Sensor Analysis |
|---|---|
![]() |
![]() |
- Why This Project Matters
- Key Results
- Project Overview
- How It Works
- Dashboard Features
- Project Structure
- Installation & Running
- Tools & Versions
- Key Learnings
- Limitations
- Future Work
- Demo
- Dataset
- Author
Unplanned aircraft engine failures are among the most costly and dangerous events in commercial aviation. Traditional time-based maintenance services every engine on a fixed schedule regardless of actual condition β leading to wasted resources or, worse, missed failures.
This system addresses that gap by:
- π Detecting degradation 122 cycles before failure β giving maintenance teams a large, actionable window
- π° Reducing maintenance costs by an estimated 96% β from ~$2M to ~$80K on a 100-engine fleet
- π¬ Explaining every alert β XAI identifies the exact failing sensor (s14, s9, or s11), not just a black-box flag
- π Deploying as a production web app β usable by non-technical maintenance operators with no data science background
Predictive maintenance powered by interpretable AI can save millions and prevent accidents in real-world aviation systems.
| Metric | Value | Source |
|---|---|---|
| π Best ROC-AUC | 0.7811 | Fuzzy Clustering (Notebook baseline) |
| π€ LSTM ROC-AUC | 0.6915 | LSTM Autoencoder (Notebook baseline) |
| π Silhouette Score | 0.6433 | Fuzzy Clustering β strong cluster separation |
| β Engine Detection Rate | 100% (20/20) | All baseline models |
| β±οΈ Early Warning Lead Time | 122 cycles | Before failure point |
| π¬ Primary Failure Sensors | s14, s9, s11 | XAI per-sensor MSE decomposition |
| πΈ Estimated Cost Reduction | 96% | $2M β $80K on 100-engine fleet |
This project follows a dual-phase architecture that mirrors professional data science practice β separating exploratory research from production engineering.
| Phase | Deliverable | Focus |
|---|---|---|
| Phase 1 β Research | notebooks/1-EDA_and_Cleaning.ipynb |
EDA, global IQR exploration, MinMaxScaler, LSTM Autoencoder & Fuzzy Clustering baselines |
| Phase 2 β Production | app/app.py |
PCA Reconstruction Autoencoder, per-engine IQR, StandardScaler, XAI, RUL forecasting, fleet batch report |
Why the two phases differ by design:
| Decision | Notebook (Research) | App (Production) |
|---|---|---|
| IQR method | Global β across all engines | Per-engine β respects each engine's baseline |
| Outlier handling | Flags created, no rows removed | Rows with β₯3 flags removed |
| Scaler | MinMaxScaler [0,1] β required for LSTM |
StandardScaler β required for PCA distance |
Raw Data (20,631 rows Γ 26 cols)
β
7-Step Cleaning
(per-engine IQR Β· drop 7 constant columns Β· remove rows with β₯3 outlier flags)
β
Feature Engineering
(RUL = max_cycle β current_cycle Β· 13 STRONG_FEATURES with |r| > 0.5)
β
StandardScaler β fit on healthy engines only (RUL > 125)
β
PCA Reconstruction Autoencoder (95% variance retained)
β
Anomaly Score = Mean MSE over last 50 cycles
β
Percentile Thresholds β derived from healthy training distribution
(95th β MONITOR Β· 98th β WARNING Β· 99.5th β URGENT)
β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π’ HEALTHY Β· π‘ MONITOR Β· π WARNING Β· π΄ URGENT β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
XAI: Per-sensor MSE decomposition
β s14 (+262%) Β· s9 (+193%) Β· s11 (+81%)
All four zone boundaries are statistically derived from training data β no hardcoded values:
| Zone | Boundary | Operational Action |
|---|---|---|
| π’ HEALTHY | < 95th percentile MSE | Normal operations |
| π‘ MONITOR | 95th β 98th percentile | Inspect within 30 days |
| π WARNING | 98th β 99.5th percentile | Inspect within 7 days |
| π΄ URGENT | > 99.5th percentile | Immediate maintenance required |
| Tab | What You'll Find |
|---|---|
| π EDA | Engine lifetime distribution, sensor correlation heatmap, raw data sample, unique value audit |
| π§Ή Data Cleaning | Cleaning log Β· per-engine IQR outlier chart Β· StandardScaler parameters Β· PCA summary cards Β· training error histogram proving threshold derivation |
| π RUL Analysis | Feature-RUL Pearson correlations Β· 6 sensor degradation subplots Β· Predicted vs Actual RUL with out-of-sample RΒ² (leave-one-out) |
| π¬ Sensor XAI | Original vs PCA-reconstructed plots for s14, s9, s11 Β· per-sensor MSE heatmap Β· rolling error timeline showing exact failure crossing point |
| π¨ Batch Report | Fleet-wide status cards Β· urgent alert banners Β· sortable colour-coded engine table Β· CSV export |
NASA-Turbofan-Predictive-Maintenance/
β
βββ app/
β βββ app.py # β
Production Streamlit dashboard
β
βββ notebooks/
β βββ 1-EDA_and_Cleaning.ipynb # π EDA, cleaning, LSTM, Fuzzy baselines
β
βββ assets/
β βββ dashboard.png # πΈ Add screenshot after running the app
β βββ xai_heatmap.png # πΈ Add XAI tab screenshot after running
β
βββ data/
β βββ raw/
β βββ CMap_FD001/
β βββ train_FD001.txt # π NASA CMAPSS FD001 (download separately)
β
βββ models/
β βββ scaler.pkl # πΎ MinMaxScaler from notebook (LSTM only)
β
βββ reports/
β βββ Project_Report_final.docx # π Full 17-section technical report
β
βββ requirements.txt # π¦ Python dependencies
βββ .gitignore # π« Files excluded from version control
βββ LICENSE # βοΈ MIT License
βββ README.md # π This file
git clone https://github.com/YOUR_USERNAME/NASA-Turbofan-Predictive-Maintenance.git
cd NASA-Turbofan-Predictive-Maintenancepip install -r requirements.txtstreamlit run app/app.py- Select "Use sample (FD001)" in the sidebar for an instant demo β no data download required
- Or upload your own
train_FD001.txtfor real results - Pick any engine from the dropdown menu
- Navigate the 5 tabs: EDA β Data Cleaning β RUL Analysis β Sensor XAI β Batch Report
- Download the full fleet health report as CSV from Tab 5
| Library | Version | Purpose |
|---|---|---|
| Streamlit | 1.32+ | Interactive web dashboard (5 tabs, CSV export) |
| Scikit-learn | 1.4+ | StandardScaler Β· PCA Β· LinearRegression |
| Pandas | 2.0+ | Data manipulation, per-engine groupby operations |
| NumPy | 1.26+ | Vectorised MSE computation, percentile thresholds |
| Matplotlib | 3.8+ | Custom sensor plots, XAI visualisations |
| Seaborn | 0.13+ | Correlation and MSE heatmaps |
| Library | Version | Purpose |
|---|---|---|
| PyTorch | 2.0+ | LSTM Autoencoder β custom class, Adam optimiser, MSELoss |
| scikit-fuzzy | 0.4.2 | Fuzzy C-Means clustering baseline |
| Statsmodels | 0.14+ | VIF multicollinearity analysis |
| Scikit-learn | 1.4+ | MinMaxScaler for LSTM input normalisation |
| Joblib | 1.3+ | Save/load fitted scaler as .pkl |
These reflect real engineering decisions made during the project β not just theory:
1. Transitioning research to production is the hardest part. The notebook and the app use different pipelines by design. MinMaxScaler works for LSTM because neural networks need bounded inputs. StandardScaler is required for PCA because reconstruction error is a Euclidean distance metric sensitive to variance, not range. Both are correct β for their context.
2. Data leakage hides in unexpected places. The RUL regression model uses leave-one-out: the selected engine is excluded from training entirely. A naive row-level train/test split would let the model see the same engine's earlier cycles during training and report an inflated RΒ² that doesn't reflect real generalisation.
3. Outliers in predictive maintenance are not noise β they are signal. Global IQR incorrectly flags sensors that are normal for that engine but unusual compared to a different engine's baseline. Per-engine IQR was the only statistically defensible choice for production because each engine operates at slightly different baseline conditions.
4. Interpretability is as important as accuracy. A maintenance engineer needs to know which component is failing and when it crossed the threshold β not a probability score. The per-sensor MSE heatmap and rolling error timeline directly answer both questions, which a black-box model cannot.
5. Thresholds must come from data, not assumptions. Deriving zone boundaries from the 95th, 98th, and 99.5th percentiles of the healthy training distribution means the system self-calibrates to each dataset. Hardcoded thresholds break silently when the data distribution shifts.
Single operating condition only. The model was trained and evaluated on FD001 (one flight regime). Performance on FD002βFD004 (multiple operating conditions) has not been validated.
PCA trades accuracy for interpretability. PCA is a linear method and will not capture non-linear degradation patterns as effectively as a trained LSTM Autoencoder. The ROC-AUC gap (0.69 LSTM vs PCA proxy) reflects this trade-off β accepted because interpretability is essential for production deployment.
No real-time data streaming. The dashboard processes historical batch data. A production deployment would require integration with a live sensor feed and incremental model updates.
Synthetic sample data differs from real NASA data. The built-in demo uses synthetic data generated with realistic degradation trends. Exact threshold values and RΒ² scores will differ when using the real dataset.
RUL forecasting is a linear baseline. LinearRegression on the PCA latent space is a first-order approximation. A dedicated LSTM regressor would capture the non-linear degradation curve more accurately.
| Priority | Enhancement | Why It Matters |
|---|---|---|
| π΄ High | Integrate trained LSTM .pth model file into the app |
Replace PCA proxy with the trained deep learning model |
| π΄ High | Extend to multi-condition datasets (FD002βFD004) | Validate generalisation across operating regimes |
| π‘ Medium | Rolling re-training / online learning | Adapt to new data without full retraining |
| π‘ Medium | Adaptive percentile thresholds | Auto-adjust zone boundaries as data accumulates |
| π‘ Medium | Email / SMS alert integration for URGENT events | Notify maintenance teams automatically |
| π’ Low | Deploy to Streamlit Cloud / AWS / Azure | Make the dashboard publicly accessible |
| π’ Low | Hybrid model β deep learning + statistical methods | Combine LSTM temporal accuracy with PCA interpretability |
To record a demo:
- Run
streamlit run app/app.py - Screen-record a walkthrough of all 5 tabs
- Upload to YouTube or Loom
- Replace the placeholder below with your link
π₯ Watch Demo: [link_here]
A full 17-section detailed technical report is included for in-depth analysis:
π₯ Download: Technical Report
NASA CMAPSS FD001 β Commercial Modular Aero-Propulsion System Simulation
Saxena, A., Goebel, K., Simon, D., & Eklund, N. (2008). Damage Propagation Modeling for Aircraft Engine Run-to-Failure Simulation. NASA Ames Research Center.
| Property | Value |
|---|---|
| Rows | 20,631 |
| Columns | 26 (2 ID + 3 settings + 21 sensors) |
| Engines | 100 (run-to-failure) |
| Operating condition | Single (FD001) |
| Headers / target variable | None β both constructed manually |
π₯ Download: https://ti.arc.nasa.gov/tech/dash/groups/pcoe/prognostic-data-repository/
Place the downloaded file at: data/raw/CMap_FD001/train_FD001.txt
π©βπ» Author
Mennatullah Mohammed Kh
AI & Intelligent Systems Student β 3rd Year Computer Science - AI Engineer
π LinkedIn: https://www.linkedin.com/in/menna-mohammed11/
π GitHub: http://github.com/mennamohammedkh
Open to AI/ML internship and junior data scientist opportunities.
LSTM Autoencoder Predictive Maintenance Anomaly Detection NASA CMAPSS
RUL Estimation Fuzzy Clustering XAI Time Series PyTorch
Streamlit Machine Learning Deep Learning
MIT License β see LICENSE for details.
If this project was useful, consider giving it a β β it helps others find it.



