Skip to content

Cybing521/Paper-Reproduction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ADFG: Adaptive Dynamic Fusion Graph Neural Network for RUL Prediction

Python PyTorch License

Reproduction of paper: "Remaining Useful Life Prediction Method for Turbofan Engines Based on Graph Neural Networks"
IEEE Sensors Journal, Vol. 25, No. 8, 15 April 2025


Overview

This repository implements the Adaptive Dynamic Fusion Graph (ADFG) neural network for predicting the Remaining Useful Life (RUL) of turbofan engines using the NASA C-MAPSS dataset.

Key Features

  • Multi-Scale CNN (MSCNN): Extracts multi-level hidden features from sensor data
  • Dynamic Graph Construction: Builds KNN-based adjacency matrices with Graph Autoencoder
  • Adaptive Fusion Mechanism: GRU-like fusion of prior knowledge and dynamic similarity graphs
  • Graph Attention Network (GAT): Aggregates spatial features across sensors
  • Temporal Attention + BiGRU: Captures temporal dependencies in sequences

Project Structure

Paper-Reproduction/
├── src/                      # Source code
│   ├── configs/              # Configuration files
│   │   └── default.yaml
│   ├── data/                 # Data processing
│   │   ├── cmapss_loader.py  # Data loading
│   │   ├── normalization.py  # Normalization strategies
│   │   └── dataset.py        # PyTorch Dataset
│   ├── models/               # Model components
│   │   ├── mscnn.py          # Multi-scale CNN
│   │   ├── graph_builder.py  # Dynamic graph (KNN + GAE)
│   │   ├── adaptive_fusion.py# Adaptive fusion module
│   │   ├── gat.py            # Graph attention layer
│   │   ├── temporal.py       # Temporal attention + BiGRU
│   │   └── adfg.py           # Full ADFG model
│   ├── utils/                # Utilities
│   │   ├── metrics.py        # RMSE & NASA Score
│   │   ├── logger.py         # Experiment logging
│   │   └── seed.py           # Random seed & device
│   ├── trainer.py            # Training loop
│   └── run.py                # Main entry point
├── examples/                 # Example scripts
│   ├── run_fd001.py          # Quick start for FD001
│   ├── run_all_datasets.py   # Run all 4 datasets
│   └── tune_fd001_fd003.py   # Hyperparameter tuning
├── experiments/              # Experiment logs (auto-generated)
├── demo/                     # Reference implementation
├── paper/                    # Original paper PDF
├── requirements.txt
└── README.md

Installation

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/Paper-Reproduction.git
cd Paper-Reproduction

2. Create Virtual Environment

# Using venv
python -m venv venv
source venv/bin/activate  # Linux/macOS
# venv\Scripts\activate   # Windows

# Or using conda
conda create -n adfg python=3.10
conda activate adfg

3. Install Dependencies

pip install -r requirements.txt

Dataset

This project uses the NASA C-MAPSS (Commercial Modular Aero-Propulsion System Simulation) dataset.

Download

Download from Kaggle: NASA C-MAPSS Dataset

Setup

After downloading, extract and place the files:

mkdir -p CMAPSSData
# Extract downloaded archive to CMAPSSData/
# Should contain: train_FD00*.txt, test_FD00*.txt, RUL_FD00*.txt

Dataset Overview

Subset Train Engines Test Engines Operating Conditions Fault Modes
FD001 100 100 1 1 (HPC)
FD002 260 259 6 1 (HPC)
FD003 100 100 1 2 (HPC+Fan)
FD004 249 248 6 2 (HPC+Fan)

Quick Start

Run Single Dataset

python examples/run_fd001.py

Run All Datasets

python examples/run_all_datasets.py

Using Main Entry Point

# Default configuration
python -m src.run --fd FD001

# Custom parameters
python -m src.run --fd FD003 --epochs 100 --lr 0.001 --exp-name my_experiment

# Using config file
python -m src.run --config src/configs/custom.yaml

Model Architecture

Input: Sensor time series (B, T, N, S)
                    │
    ┌───────────────▼───────────────┐
    │   MSCNN (Multi-Scale CNN)     │
    │   kernels: [1, 3, 5, 7]       │
    └───────────────┬───────────────┘
                    │ (B, T, N, F)
    ┌───────────────▼───────────────┐
    │   Dynamic Graph Construction  │
    │   KNN + Graph Autoencoder     │
    └───────────────┬───────────────┘
                    │
    ┌───────────────▼───────────────┐
    │   Adaptive Fusion (GRU-like)  │
    │   A''' = Z⊙H + (1-Z)⊙A'       │
    └───────────────┬───────────────┘
                    │
    ┌───────────────▼───────────────┐
    │   Graph Attention Network     │
    │   Multi-head attention        │
    └───────────────┬───────────────┘
                    │ (B, T, N, F')
    ┌───────────────▼───────────────┐
    │   Temporal Attention + BiGRU  │
    │   Sequence modeling           │
    └───────────────┬───────────────┘
                    │
                    ▼
            Output: RUL (B,)

Adaptive Fusion Mechanism

The adaptive fusion module (Equations 5-9 in the paper) combines prior knowledge graph and dynamic similarity graph:

Δ = ||A' - A''||_F                      # (5) Frobenius norm
Z_t = σ(W_Z · Δ + B_1)                  # (6) Update gate
R_t = σ(W_R · Δ + B_2)                  # (7) Reset gate
H_t = tanh(W_H · A'' + W'_H · R_t + B_3) # (8) Candidate state
A''' = Z_t ⊙ H_t + (1 - Z_t) ⊙ A'       # (9) Fused output

Note: W_H and W'_H are independent learnable parameter matrices.


Experiment Tracking

Each experiment automatically creates a folder in experiments/ containing:

File Description
config.yaml Experiment configuration
metrics.csv Training metrics per epoch
best_model.pt Best model checkpoint
history.json Complete training history
summary.txt Runtime logs
report.txt Final experiment report

Target Performance

Dataset Target RMSE Target Score
FD001 10-11 ~200
FD002 ~13 ~500
FD003 10-11 ~250
FD004 ~14 ~600

Hyperparameter Tuning

For FD001/FD003 (Single Operating Condition)

window_size: 30-40     # Larger window
seq_len: 10-15         # Sequence length
k: 5-7                 # KNN neighbors
epochs: 80-100         # More epochs
scheduler:
  enabled: true
  type: cosine

For FD002/FD004 (Multiple Operating Conditions)

window_size: 15-20     # Smaller window
k: 8-10                # More KNN neighbors
normalization: cond_zscore  # Condition-based normalization (default)

Tuning Script

python examples/tune_fd001_fd003.py

Requirements

torch>=2.0.0
numpy>=1.21.0
pandas>=1.3.0
scikit-learn>=1.0.0
pyyaml>=6.0
tqdm>=4.62.0

Citation

@article{cao2025remaining,
  title={Remaining Useful Life Prediction Method for Turbofan Engines 
         Based on Graph Neural Networks},
  author={Cao, Xiangang and Cheng, Boyang and Yang, Xin and 
          Duan, Yong and Gao, Jiajun},
  journal={IEEE Sensors Journal},
  volume={25},
  number={8},
  year={2025},
  publisher={IEEE}
}

License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments

  • NASA for the C-MAPSS dataset
  • Original paper authors for the ADFG architecture

About

来源与背景 发表背景: 传统的剩余寿命(RUL)预测方法(如CNN、LSTM)主要将传感器数据视为多变量时间序列,虽然能提取时间特征,但往往忽略了传感器之间复杂的拓扑关系和空间相关性(例如:进气道压力和涡轮温度之间存在物理上的联动关系)。 核心理念: 将航空发动机的多个传感器看作图(Graph)中的节点,将传感器之间的关联看作边,利用图神经网络(GNN)来捕捉这些空间特征。

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages