End-to-end ML-powered predictive maintenance system for turbofan engines
Features β’ Quick Start β’ Architecture β’ Dashboard β’ Contributing
FailSight is an intelligent predictive maintenance platform built on NASA CMAPSS turbofan engine sensor telemetry. It combines machine learning, reliability engineering, and advanced data visualization to:
- π― Predict Remaining Useful Life (RUL) with LightGBM models
- π΄ Detect Anomalies using IsolationForest unsupervised learning
- π Analyze Reliability using Weibull failure distributions
- π Forecast Spare Parts demand across your fleet
- π¬ Answer Questions using LangGraph AI agent with RAG
- β° Automate Operations with APScheduler daily pipelines
| Component | Technology |
|---|---|
| Data Pipeline | Python β’ Pandas β’ SQL (SQLite) β’ APScheduler |
| ML Models | LightGBM β’ Scikit-learn β’ IsolationForest |
| Reliability | Weibull β’ Statistical Analysis |
| Dashboard | Streamlit β’ Plotly β’ Pandas |
| AI Agent | LangChain β’ LangGraph β’ ChromaDB β’ OpenAI/Groq |
| Dataset | NASA CMAPSS (Turbofan Degradation) |
- β Automated ingestion & cleaning from NASA CMAPSS dataset
- β SQLite database with 160K+ sensor readings
- β Robust error handling and logging
- β Rolling statistics (mean/std over windows [5, 10, 20])
- β Temporal lag features (lags [1, 3, 5])
- β Degradation index (composite sensor metric)
- β Cycle ratio (lifecycle position)
- β Anomaly scores & severity metrics
- β LightGBM RUL prediction model
- β Train/validate/test split with proper evaluation
- β IsolationForest anomaly detection (contamination=5%)
- β Model persistence with joblib
- β Weibull distribution fitting
- β MTTF (Mean Time To Failure) estimation
- β Hazard rate curves
- β Per-subset failure patterns
- β Spare parts replacement prediction
- β Critical/warning threshold-based demand
- β Weekly forecasting windows
- π± Dashboard Page β Fleet KPIs, status breakdown, RUL distribution
- π Data Exploration β EDA, feature distributions, correlations, time series
- ποΈ Unit Explorer β Per-unit deep dive with sensor data & anomalies
- π΄ Anomaly Explorer β Heatmaps, top anomalous units, anomaly-RUL correlation
- π Reliability Analysis β Weibull plots, MTTF, hazard rates
- π¬ AI Agent β Natural language querying & automated reports
- β Daily automated pipeline runs at midnight
- β Full lifecycle: ingest β features β train β vectorstore
- β Comprehensive logging with timestamps
- β Error handling & failure alerts
- Python 3.11+
- 2GB+ RAM (for feature engineering)
- ~500MB disk space
# Clone repository
git clone https://github.com/divyat2605/failsight-predictive-maintenance
cd failsight-predictive-maintenance
# Create virtual environment
python -m venv myenv
source myenv/bin/activate # On Windows: myenv\Scripts\activate
# Install dependencies
pip install -r requirements.txt# Option 1: Run pipeline steps manually
python pipelines/ingest.py # Download & process CMAPSS data
python pipelines/features.py # Engineer features + detect anomalies
python models/train_rul.py # Train LightGBM model
python agent/build_vectorstore.py # Build ChromaDB vector store
# Option 2: Run automated daily scheduler
python pipelines/scheduler.py # Runs all steps daily at midnightstreamlit run dashboard/app.pyThen visit http://localhost:8501 in your browser.
- 6 KPI Cards β Total units, critical/warning/healthy counts, avg RUL, units with anomalies
- RUL Distribution β Histogram with threshold markers
- Fleet Status Pie β Visual breakdown by status
- Alerts Table β Critical units with action items
- Dataset Overview β Statistics, subset distribution, feature breakdown
- Feature Distributions β Histograms for sensors, engineered features, RUL
- Correlation Analysis β Heatmaps, feature-RUL rankings, sensor correlations
- Time Series β Select unit & visualize sensor trends + anomalies
- Feature Engineering Impact β Raw vs smoothed signals, rolling statistics demo
- Anomaly Insights β Anomaly rates, early warning indicators, anomalous sensor rankings
- Per-Unit Metrics β RUL, status, cycle count, anomaly rate
- Sensor Time Series β Plot any sensor with anomaly overlays
- Degradation Index β Composite health trend
- Multi-Sensor Comparison β Plot multiple sensors simultaneously
- Heatmap β Anomaly rate across units Γ subsets
- Top 10 Table β Most anomalous units with first anomaly cycle
- Scatter Plot β First anomaly cycle vs predicted RUL (early warning)
- Weibull Fitting β Shape (Ξ²) and scale (Ξ±) parameters
- MTTF Calculation β Mean time to failure by subset
- Hazard Rate Curves β Failure probability over time
- Per-Subset Analysis β FD001/FD002/FD003/FD004 comparisons
- Natural Language Chat β Ask questions about fleet health
- Auto Reports β Generate failure summaries for critical units
- Context-Aware β RAG integration with processed data
- Multi-Turn Dialogue β Conversation history maintained
failsight-predictive-maintenance/
βββ config.py # Configuration & constants
βββ requirements.txt # Python dependencies
βββ README.md # This file
β
βββ pipelines/
β βββ ingest.py # CMAPSS download & preprocessing
β βββ features.py # Feature engineering & anomaly detection
β βββ scheduler.py # Daily pipeline orchestrator (APScheduler)
β
βββ models/
β βββ train_rul.py # LightGBM model training
β βββ saved/ # Saved models & artifacts
β
βββ analysis/
β βββ weibull_analysis.py # Reliability analysis
β βββ spare_parts.py # Demand forecasting
β βββ anomaly_detection.py # IsolationForest anomaly detection
β
βββ agent/
β βββ failsight_agent.py # LangGraph AI agent
β βββ build_vectorstore.py # ChromaDB vector store builder
β βββ vectorstore/ # Persisted embeddings
β
βββ dashboard/
β βββ app.py # Streamlit multi-page dashboard
β
βββ data/
β βββ raw/ # CMAPSS dataset
β βββ processed/ # Features, models, database
β
βββ dags/
βββ failsight_dag.py # Airflow DAG (reference)
Edit config.py to customize:
# Paths
DATA_RAW_DIR = "data/raw"
DATA_PROCESSED_DIR = "data/processed"
MODELS_DIR = "models/saved"
# Model parameters
RANDOM_STATE = 42
TEST_SIZE = 0.2
MAX_RUL = 125
# Thresholds
RUL_CRITICAL_THRESHOLD = 30
RUL_WARNING_THRESHOLD = 60
# Anomaly detection
CONTAMINATION_RATE = 0.05 # 5% of cycles flaggedCMAPSS Download
β
Ingest (ingest.py) β Clean sensors, add RUL
β
Features (features.py) β Rolling stats, lags, degradation, anomalies
β
Train (train_rul.py) β LightGBM model training & validation
β
Vectorstore (build_vectorstore.py) β ChromaDB embeddings for AI agent
β
Dashboard β Live monitoring & insights
Automated by: scheduler.py (runs daily at midnight)
LightGBM RUL Prediction
Training samples: 128,287
Validation samples: 32,072
RMSE: 18.5 cycles
MAE: 12.3 cycles
RΒ² Score: 0.87
Total Anomalies: 8,120 (5.06% of cycles)
Units Affected: 256/260 (98%)
Average Anomaly Rate: 5.1%
Most Anomalous Subset: FD003
python pipelines/ingest.py # Just download & clean
python pipelines/features.py # Just engineer features
python models/train_rul.py # Just retrain modelimport pandas as pd
from analysis.anomaly_detection import get_anomaly_summary
# Load processed data
df = pd.read_parquet("data/processed/features.parquet")
# Get anomaly stats
anomaly_summary = get_anomaly_summary(df)
print(anomaly_summary)Edit pipelines/scheduler.py:
# Run at 6 AM instead of midnight
trigger = CronTrigger(hour=6, minute=0)| Metric | Value |
|---|---|
| Dataset Size | 160,359 sensor readings |
| Number of Units | 260 turbofan engines |
| Subsets (Conditions) | 4 (FD001-FD004) |
| Total Features | 150+ engineered features |
| Model Accuracy | 87% (RΒ² score) |
| Anomaly Detection Rate | 5.1% (configurable) |
| Dashboard Response | <2s (cached) |
Contributions welcome! Areas for enhancement:
- Add LSTM/GRU models for RUL prediction
- Implement XGBoost & CatBoost comparisons
- Extended Kalman Filter for RUL
- Multi-step ahead forecasting
- Alert notification system (email/Slack)
- Cloud deployment (AWS/Azure/GCP)
- REST API for model inference
- Unit tests & CI/CD pipeline
Apache License Version 2.0
Repository: https://github.com/divyat2605/failsight-predictive-maintenance
Issues: GitHub Issues
Built with β€οΈ for predictive maintenance
FailSight β Making engines reliable, systematically