CD-PINODE code and dataset
Description
This repository contains the source code and synthetic dataset supporting the study "CD-PINODE: A Physics-Informed Neural Ordinary Differential Equation Framework for Joint Fault Classification and Remaining Useful Life Estimation in Turbofan Engines." Five prognostics models are implemented and benchmarked on NASA C-MAPSS synthetic sensor data across two co-dependent tasks: (1) binary fault classification (HPC compressor degradation and FAN blade erosion) and (2) continuous Remaining Useful Life (RUL) regression. Each model is evaluated on both an in-distribution test set and a harder out-of-distribution (OOD) test set simulating unseen degradation regimes. The proposed model, CD-PINODE v4, integrates a Neural Ordinary Differential Equation backbone with Brayton-cycle physical constraints, a distance correlation regularizer (dcorr: 0.0471 → 0.0034), and a joint multi-task loss. It achieves in-distribution RUL RMSE of 22.10 and OOD RMSE of 35.05, with OOD HPC balanced accuracy of 84.06% and FAN balanced accuracy of 71.82% using only 61,286 trainable parameters. Four baselines are included for direct comparison: an LSTM Joint Baseline, a Physics-Informed Autoencoder (PI-AE), a CNN-BiLSTM with channel attention, and a GPU-aware Random Forest. All scripts support CUDA acceleration with automatic CPU fallback. Dataset files: - synthetic_train_data.csv — training split (21 sensor channels, HPC/FAN fault labels, RUL targets) - synthetic_test_data.csv — in-distribution test split - synthetic_ood_data_harder.csv — OOD test split (harder degradation regimes) Code files: - cd-pinode_v4_linux.py — proposed CD-PINODE v4 model - lstm_4.py — LSTM baseline - pi_autoencoder_linux.py — PI-Autoencoder baseline - cnn_bilstm_attn_ linux.py — CNN-BiLSTM+Attn baseline - Random_forest_linux.py — GPU-aware Random Forest baseline
Files
Steps to reproduce
Steps to Reproduce 1. Environment Setup Install the required Python packages: ```bash pip install torch torchvision torchaudio # PyTorch (CUDA build recommended) pip install torchdiffeq # Neural ODE integration pip install scikit-learn numpy pandas scipy matplotlib ``` Tested configuration: Python 3.8+ PyTorch 1.12+ (CUDA 11.x optional; all scripts fall back to CPU automatically) scikit-learn 1.1+ --- 2. Data Placement Place the three dataset files in a single directory: ``` /your/local/path/NASA C-MAPSS dataset/ ├── synthetic_train_data.csv ├── synthetic_test_data.csv └── synthetic_ood_data_harder.csv ``` Open each script and set `DATA_DIR` at the top of the file to match your local path: ```python DATA_DIR = "/your/local/path/NASA C-MAPSS dataset" ``` --- 3. Running Each Model Execute scripts individually. Each script trains the model, evaluates on both in-distribution and OOD test sets, and prints all metrics to stdout. CD-PINODE v4 (proposed model): ```bash python CP-PINODE v4_Linux.py ``` Expected outputs: training loss per epoch, best composite epoch (epoch 21), validation balanced accuracy (91.64–91.94%), in-dist RUL RMSE 22.10 / MAE 11.41, OOD RMSE 35.05 / MAE 23.64, HPC/FAN balanced accuracy, Macro F1, PH±10%, NASA PHM08 Score, latent dcorr. LSTM Joint Baseline: ```bash python LSTM 4_linux.py ``` Expected outputs: in-dist RUL RMSE 23.37, OOD RMSE 31.08, OOD HPC Bal.Acc 82.54%, FAN 71.78%. PI-Autoencoder Baseline: ```bash python PI-Autoencoder_Linux.py ``` Expected outputs: in-dist RMSE 90.38, OOD RMSE 92.22 / MAE 62.31, CLS-head HPC/FAN balanced accuracy. CNN-BiLSTM + Attention Baseline: ```bash python CNN_BiLSTM_Attn-linux.py ``` Expected outputs: early stop at epoch 9, in-dist RUL RMSE 46.65, OOD RMSE 65.09 / MAE 51.27, OOD Macro F1 88.88%. GPU-aware Random Forest Baseline: ```bash python Random forest-linux.py ``` To redirect output files, set the environment variable before running: ```bash RF_OUTPUT_DIR=/custom/output/path python Random forest-linux.py ``` Expected outputs: in-dist RUL RMSE 78.20, OOD HPC Bal.Acc 69.53%, FAN 50.00%, CPU fallback message if RAPIDS cuML is not installed. --- 4. Reproducing Classification Report Tables To regenerate Table 3 (HPC OOD) and Table 4 (FAN OOD) from the paper: ```bash python cd-pinode_v3_table_3_4.py ``` This script loads the trained CD-PINODE v3 checkpoint and prints per-class precision, recall, F1-score, and support for both fault types. --- 5. Notes All random seeds are fixed within each script for reproducibility. GPU is used automatically if `torch.cuda.is_available()` returns `True`; otherwise CPU is used with no code changes required. The Random Forest script does not require RAPIDS cuML; scikit-learn CPU fallback is built in. Total runtime on a single NVIDIA GPU (e.g., RTX 3090): approximately 5–15 minutes per model depending on dataset size and hardware.
Institutions
- Texas A&M University – Corpus ChristiTexas, Corpus Christi