Physical AI is an integrated framework that combines digital twin cardiovascular models with modern machine learning / generative AI techniques.
This repository is the starting platform for future development of full digital twin–guided physiological AI applications.
Currently, the repo includes two core modules:
- Physically-Informed Generative AI (
phys_informed_gen_ai) - Classifiers Learning from Digital Twin Simulations (
classifiers_learn_sims)
Both modules live under src/ and interact with data, pretrained models, digital twin simulations, and output results.
PhysicalAI/
│
├── data/ # All datasets used by the two modules
│
├── model/ # Trained VAE models & classifier PyTorch checkpoints
│
├── result/ # Synthetic data, evaluation plots, predictions
│
└── src/
├── phys_informed_gen_ai/ # VAE + digital twin hybrid generative module
│ ├── main.ipynb # Main notebook for VAE-based generative DT framework
│ └── *.m # MATLAB scripts for physical constraints (DT validation)
│
└── classifiers_learn_sims/ # Classifier training & prediction module
└── main.ipynb # Main notebook for training & inference
This module uses a VAE trained on HFpEF digital twin phenotypes to generate new virtual digital twin samples.
- Random sampling from the VAE latent space
- No covariance constraints
- Sampling from a multivariate Gaussian that preserves the training-set latent covariance
- Produces more realistic synthetic phenotypes
- Based on (2), but each generated sample is validated using the digital twin model (MATLAB)
- Only physiologically consistent samples are retained
- This forms a hybrid digital twin + AI dataset
Generated data are stored under:
result/
├── VirtualDT_original.csv
├── VirtualDT_correlated.csv
└── VirtualDT_phys.csv
Located in result/:
Z_Sampling_Methods_Comparison.pngVAE_reconstruction_PDF_CC.pngVAE_reconstruction_PDF_CC.png
These compare the latent sampling methods and reconstruction properties.
All MATLAB scripts under this directory are used to:
- Evaluate generated samples for physiological plausibility
- Reject unrealistic digital twins
- Produce final “physically-informed” synthetic datasets
This module trains classification models using labels derived from digital twin simulations.
Located in data/:
TrainingC.csvTestingC.csv
Located in model/:
model_LabelCO_best.pthmodel_LabelFillingP_best.pth- (additional best models)
In result/:
evaluation_plots/ # Confusion matrices (train/validation)
external_validation_plots/ # Confusion matrices for external test set
You can run the full pipeline on new clinical data.
Replace the placeholder file:
data/inputclassifierMYPACE.csv
The repo includes 10 synthetic example patients.
Replace them with real patients using identical column names.
Inside:
src/classifiers_learn_sims/main.ipynb
Run the second-to-last cell (the script clearly marks it).
Results will appear in:
result/inputclassifierMYPACE_with_predictions.csv
The final cell in main.py contains a detailed explanation of the inference pipeline.
This repository is the initial version of a broader “Physical AI” framework which will include:
- PINN-based digital twin inversion
- Longitudinal prediction models
- Adaptive pacing-response estimation
- Full digital-heart physical simulation integration
Future updates will expand the src/ modules and add additional datasets and models.
- Python 3.8–3.11
- PyTorch
- NumPy / SciPy / Pandas / Matplotlib
- MATLAB + MATLAB Engine for physically-informed VAE filtering
For questions or collaboration:
Feng Gu
University of Michigan
Email: fenggu@umich.edu