Skip to content

Latest commit

 

History

History
113 lines (94 loc) · 7.22 KB

File metadata and controls

113 lines (94 loc) · 7.22 KB

Graph Neural Networks for Industrial Predictive Maintenance using Sensor Relationship Modeling

📌 Abstract

This repository contains a comprehensive research-oriented deep learning framework that models complex spatio-temporal relationships between multivariate industrial sensors. Utilizing the NASA CMAPSS Turbofan Engine Dataset, the system leverages Graph Neural Networks (GNNs) specifically Graph Convolutional Networks (GCN), Graph Attention Networks (GAT), and Custom Message Passing Neural Networks (MPNN) to perform Remaining Useful Life (RUL) prediction and fault analysis. By explicitly modeling component dependencies and fault propagation pathways via dynamic graph structures, this approach significantly outperforms traditional sequential modeling.

🗂️ Project Architecture & Structure

The project is highly modular and designed for both academic research and industrial deployment.

project/
│
├── data/              # NASA CMAPSS datasets (Extracted CMaps folder)
├── graphs/            # Storage for serialized NetworkX graphs and adjacency matrices
├── models/            # Target directory for saved .pth model checkpoints
├── notebooks/         # Interactive scripts and Jupyter notebooks for EDA
├── src/               # Core source code modules
│   ├── data_pipeline.py       # Data loading, normalization, sequence generation
│   ├── eda.py                 # Exploratory data analysis and visualizer class
│   ├── graph_construction.py  # Correlation thresholding and PyG Data formatting
│   ├── gnn_models.py          # PyTorch Geometric GCN, GAT, and MPNN implementations
│   ├── baselines.py           # Comparison models (LSTM, 1D-CNN, Random Forest)
│   ├── advanced_features.py   # Anomaly detection and fault propagation simulation
│   └── train.py               # Main training loop and evaluation scripts
├── visualizations/    # Output directory for heatmaps, trend plots, and graph topologies
├── experiments/       # Scripts for executing hyperparameter sweeps (run_experiments.py)
├── reports/           # Technical summaries, interview preparations, and resume points
├── app/               # Streamlit application for real-time inference and visualization
│   └── app.py
├── requirements.txt   # Required Python dependencies
└── README.md          # Project documentation

🛠️ Technical Stack

  • Core Deep Learning Frameworks: PyTorch, PyTorch Geometric (PyG)
  • Data Processing & Engineering: Pandas, NumPy
  • Graph Modeling & Mathematics: NetworkX, SciPy
  • Machine Learning & Baselines: Scikit-learn
  • Deployment & UI: Streamlit
  • Visualization: Matplotlib, Seaborn

⚙️ Installation Instructions

  1. Clone the repository and set up the environment: Create a Python virtual environment to isolate the project dependencies.

    python -m venv .venv
    # Windows
    .\.venv\Scripts\activate
    # Linux/Mac
    source .venv/bin/activate
  2. Install the required packages:

    pip install -r requirements.txt
  3. Prepare the Data: Ensure the NASA CMAPSS dataset is extracted into data/CMaps/.

🚀 Usage Guide

1. Exploratory Data Analysis

You can execute the interactive data exploration script using a Jupyter environment (or VS Code Interactive Window) to visualize sensor trends and correlation heatmaps.

# Execute within a compatible IDE or convert to notebook
python notebooks/1_data_exploration.py

2. Model Training and Evaluation

The train.py script acts as the entry point for generating sequences, building the sensor correlation graphs, and executing the PyTorch training loop. The trained state dictionary will be automatically saved to the models/ directory.

python src/train.py

3. Running the Dashboard

The project includes a fully functional Streamlit web application that visualizes sensor degradation, displays the inferred sensor relationship graph, and overlays predicted engine RUL against the ground truth.

streamlit run app/app.py

🔬 Mathematical Formulations

Graph Construction

The system represents the 21 physical sensors as nodes $v \in V$ and their relationships as edges $e \in E$. The underlying topology is defined by an Adjacency Matrix $A$, generated by applying a statistical threshold to the Pearson correlation matrix of the multivariate time-series data. $A_{ij} = 1$ if $|corr(i, j)| > \tau$, where $\tau$ is the hyperparameter threshold.

Graph Convolutional Network (GCN)

GCNs update node representations by aggregating information from local neighborhoods. The symmetric normalized message passing step is defined as: $$H^{(l+1)} = \sigma(\tilde{D}^{-\frac{1}{2}} \tilde{A} \tilde{D}^{-\frac{1}{2}} H^{(l)} W^{(l)})$$ Where:

  • $H^{(l)}$ is the node feature matrix at layer $l$ containing sliding time-series windows.
  • $\tilde{A} = A + I$ (Adjacency matrix with self-loops).
  • $\tilde{D}$ is the diagonal degree matrix of $\tilde{A}$.
  • $W^{(l)}$ is the learnable weight matrix.
  • $\sigma$ is a non-linear activation function (e.g., ReLU).

Graph Attention Network (GAT)

GATs introduce masked self-attentional layers, allowing the model to dynamically weigh the importance of neighboring sensors during fault propagation: $$h_i^{(l+1)} = \sigma\left( \sum_{j \in \mathcal{N}(i)} \alpha_{ij} W h_j^{(l)} \right)$$ Where $\alpha_{ij}$ is the attention coefficient computed via a single-layer feedforward network, indicating the critical importance of sensor $j$'s degradation features to sensor $i$'s future state.

Message Passing Neural Networks (MPNN)

The custom MPNN framework generalizes the graph convolution by explicitly defining arbitrary message and update functions. In this repository, the MPNN layer concatenates sender node features, receiver node features, and scalar edge attributes (correlation coefficients) prior to passing them through a linear transformation.

📊 Experimental Findings

  • GNNs vs. Baselines: Both GCN and GAT architectures successfully captured the cascading nature of engine failure propagation significantly better than flat sequential models like LSTMs or 1D-CNNs, yielding lower Root Mean Squared Error (RMSE) on the test set.
  • Graph Attention (GAT): GAT models dynamically highlighted critical sensors (such as High-Pressure Compressor outlet temperature and bypass duct pressure) as the engine approached the failure threshold.
  • Topology: Thresholded correlation graphs (e.g., $\tau = 0.3$) provided the optimal balance between computational sparsity and necessary information flow between distant mechanical components.

🔮 Future Improvements

  1. Dynamic Edge Generation: Implementing a mechanism where the adjacency matrix dynamically evolves over time, reflecting changes in physical dependencies as the engine degrades.
  2. Spatio-Temporal Graph Convolutions (ST-GCN): Integrating specialized temporal convolution blocks intertwined with spatial graph convolutions to model local temporal dynamics explicitly.
  3. Bayesian Uncertainty Quantification: Introducing stochastic layers to provide confidence intervals around Remaining Useful Life predictions, a critical necessity in industrial safety contexts.