Inference Methods & Examples¶
VBI provides multiple approaches for parameter inference, each with different strengths and use cases.
Inference Method Overview¶
Method |
Dependencies |
Performance |
Best For |
|---|---|---|---|
CDE (Conditional Density Estimation) |
NumPy + autograd |
Fast, lightweight |
Quick inference, limited resources |
SBI (Simulation-Based Inference) |
PyTorch + sbi |
State-of-the-art |
Complex problems, research |
CDE-Based Inference (Lightweight)¶
Conditional Density Estimation using pure NumPy implementation - no PyTorch required.
Key Features:
✅ Lightweight: Only requires NumPy and autograd
✅ Fast: Efficient implementation for moderate-scale problems
✅ Transparent: Clear mathematical foundation
✅ Flexible: Easy to customize and extend
Available Methods:
When to use CDE:
Limited computational resources
Want to avoid heavy PyTorch dependency
Need transparent, interpretable inference
SBI-Based Inference (Advanced)¶
Simulation-Based Inference using PyTorch and the sbi library - state-of-the-art methods.
Key Features:
🚀 State-of-the-art: Latest neural density estimation techniques
🧠 Scalable: Handles high-dimensional problems efficiently
🔧 Comprehensive: Multiple inference algorithms (SNPE, SNLE, SNRE)
Current Examples:
Note: Most simulation examples currently use SBI for inference. We’re working on separating these into dedicated inference tutorials.
When to use SBI:
Working with high-dimensional parameter spaces (> 10 parameters)
Need state-of-the-art performance
Complex, multimodal posterior distributions
Getting Started¶
For CDE Inference:
Start with CDE Inference with MDN (Mixture Density Networks) - Learn MDN basics
Try CDE Inference with MAF (Masked Autoregressive Flows) - More advanced MAF method
Apply to your brain model of choice
For SBI Inference:
Install full VBI:
pip install vbi[inference]Check existing simulation examples that include SBI
Adapt to your specific use case
Upcoming Examples¶
We’re working on expanding the inference examples:
CDE + Brain Models: Direct application to Jansen-Rit, Wilson-Cowan models
SBI Tutorials: Dedicated SBI workflow examples
Method Comparisons: Side-by-side CDE vs SBI comparisons
Real Data Examples: Using experimental neuroimaging data
Performance Guidelines¶
CDE Performance Tips:
Use appropriate number of mixture components (MDN) or layers (MAF)
Monitor training convergence carefully
Consider data preprocessing/normalization
SBI Performance Tips:
Use GPU acceleration when available
Tune simulation budget vs accuracy trade-off
Consider sequential vs single-round inference
Memory and Speed:
CDE: Lower memory usage, faster setup
SBI: Higher memory usage, potentially faster inference for complex problems
Contributing¶
We welcome contributions of new inference examples! See our CONTRIBUTING.md for guidelines on adding new tutorials and examples.