Skip to content

About

LSTM with temporal attention for remaining-useful-life prediction from multivariate sensor data.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LSTM-based Predictive Maintenance

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.

Architecture

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.  |     +------------------+
                           +-------------------+

Features

  • 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

Project Structure

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

Quick Start

Installation

pip install -r requirements.txt

Generate Synthetic Data

python src/data_processor.py --generate

Train Model

python src/trainer.py

Monitor training progress:

tensorboard --logdir logs/

Evaluate Model

python src/trainer.py --evaluate --checkpoint models/best_model.pt

Start API Server

uvicorn src.api:app --host 0.0.0.0 --port 8000

Model Architecture

RULPredictor (Primary)

  • 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

StackedLSTM (Variant)

  • Bidirectional LSTM option for richer sequence representations
  • Layer normalization between stacked LSTM layers
  • Optional residual connections

LSTMWithResidual

  • Skip connections between LSTM layers
  • Improved gradient flow for deeper architectures
  • Configurable residual projection

Sensor Channels

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

Training Configuration

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

Evaluation Metrics

  • 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

License

MIT License

About

LSTM with temporal attention for remaining-useful-life prediction from multivariate sensor data.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages