Remaining Useful Life (RUL) estimation using LSTM networks on multivariate sensor time series. Predicts equipment failure windows from vibration, temperature, and pressure data using temporal attention mechanisms. Includes anomaly detection and real-time health scoring.
Sensor Time Series LSTM Model Output
(14 channels)
| +-------------------+
v | Multi-layer LSTM |
+-----------+ | with Attention | +------------------+
| Normalize |----------->| Mechanism |---->| RUL Prediction |
| Sequence | | | | Health Score |
| Window | | Bidirectional | | Anomaly Flags |
+-----------+ | + Residual Conn. | +------------------+
+-------------------+
- Multi-layer LSTM with configurable depth, hidden size, and dropout
- Temporal Attention mechanism for focusing on degradation-critical time steps
- Bidirectional LSTM variant for improved sequence understanding
- Residual Connections for gradient flow in deep architectures
- Piecewise Linear RUL labels with configurable maximum cap
- Synthetic Data Generator producing realistic multi-sensor degradation profiles
- Anomaly Detection using prediction residuals and rolling statistics
- Health Index Scoring mapping RUL predictions to 0-100 scale
- REST API for real-time RUL prediction and health monitoring
- TensorBoard integration for training visualization
lstm-predictive-maintenance/
├── src/
│ ├── data_processor.py # Data loading, normalization, sequencing
│ ├── lstm_model.py # LSTM architectures with attention
│ ├── trainer.py # Training loop, evaluation, inference
│ ├── visualize.py # Visualization utilities
│ └── api.py # REST API for predictions
├── configs/
│ └── config.yaml # Model and training configuration
├── data/ # Raw and processed datasets
├── models/ # Saved model checkpoints
├── logs/ # TensorBoard logs
├── requirements.txt
└── README.md
pip install -r requirements.txtpython src/data_processor.py --generatepython src/trainer.pyMonitor training progress:
tensorboard --logdir logs/python src/trainer.py --evaluate --checkpoint models/best_model.ptuvicorn src.api:app --host 0.0.0.0 --port 8000- Multi-layer LSTM with temporal attention
- Dropout between LSTM layers for regularization
- Attention-weighted aggregation of hidden states
- Fully connected output head for RUL regression
- Bidirectional LSTM option for richer sequence representations
- Layer normalization between stacked LSTM layers
- Optional residual connections
- Skip connections between LSTM layers
- Improved gradient flow for deeper architectures
- Configurable residual projection
| Sensor | Description | Unit |
|---|---|---|
| temperature_1 | Inlet temperature | Celsius |
| temperature_2 | Outlet temperature | Celsius |
| pressure_1 | Inlet pressure | kPa |
| pressure_2 | Outlet pressure | kPa |
| vibration_x | X-axis vibration | mm/s |
| vibration_y | Y-axis vibration | mm/s |
| vibration_z | Z-axis vibration | mm/s |
| rpm | Rotational speed | RPM |
| flow_rate | Fluid flow rate | L/min |
| voltage | Supply voltage | V |
| current | Supply current | A |
| humidity | Ambient humidity | % |
| oil_temperature | Lubricant temperature | Celsius |
| bearing_temp | Bearing temperature | Celsius |
Key hyperparameters (see configs/config.yaml for full list):
| Parameter | Default | Description |
|---|---|---|
| hidden_size | 128 | LSTM hidden state dimension |
| num_layers | 2 | Number of stacked LSTM layers |
| dropout | 0.3 | Dropout rate between layers |
| sequence_length | 50 | Input window size |
| max_rul | 125 | Piecewise RUL cap |
| learning_rate | 0.001 | Initial learning rate |
| patience | 15 | Early stopping patience |
- RMSE: Root Mean Squared Error of RUL predictions
- MAE: Mean Absolute Error
- Score Function: Asymmetric scoring penalizing late predictions more heavily
- Health Score Accuracy: Correlation between predicted and actual health indices
MIT License