Probabilistic Model Specification
NimbusSDK provides pre-built probabilistic models powered by RxInfer.jl, a reactive message passing framework for efficient Bayesian inference.Three Production Models Available:
- Bayesian LDA (RxLDA) - Fast, shared covariance
- Bayesian GMM (RxGMM) - Flexible, class-specific covariances
- Bayesian Softmax (RxPolya) - Multinomial logistic regression
Model Architecture
All three models are built on factor graphs with reactive message passing:Factor Graphs
Factor graphs represent the joint probability distribution: Components:- Prior: - uniform or learned class probabilities
- Likelihood: - Gaussian (LDA/GMM) or Softmax (RxPolya)
- Posterior: - computed via message passing
Reactive Message Passing
RxInfer.jl uses reactive programming for efficient inference:- Incremental processing: Process data chunks as they arrive
- Low latency: 10-25ms per chunk
- Memory efficient: Constant memory usage
- Real-time capable: Streaming inference without buffering
Model Comparison
| Feature | RxLDA (NimbusLDA) | RxGMM (NimbusGMM) | RxPolya (NimbusSoftmax) |
|---|---|---|---|
| Covariance | Shared across classes | Class-specific | N/A (logistic) |
| Decision Boundary | Linear | Quadratic | Non-linear (flexible) |
| Flexibility | Lower | Higher | Highest |
| Speed | Fastest (10-15ms) | Fast (15-25ms) | Fast (15-25ms) |
| Training Time | Fast | Moderate | Moderate |
| Parameters | Fewer (efficient) | More (flexible) | Most (very flexible) |
| Best For | Well-separated classes | Overlapping distributions | Complex multinomial tasks |
| Overfitting Risk | Lowest | Moderate | Higher (more parameters) |
| Data Requirements | 40+ trials/class | 60+ trials/class | 80+ trials/class |
BCI Paradigm Applications
Motor Imagery
Recommended Model: Bayesian LDA (RxLDA) Motor imagery classes are typically well-separated in CSP feature space, making RxLDA ideal:- 2-class (left/right hand): 75-90% accuracy
- 4-class (hands/feet/tongue): 70-85% accuracy
- Inference: 10-15ms per trial
- ITR: 15-25 bits/minute
- Fast inference for real-time control
- Shared covariance assumption holds well
- Lowest data requirements
P300 Event-Related Potential
Recommended Model: Bayesian GMM (RxGMM) P300 target and non-target ERPs have overlapping distributions, requiring flexible modeling:- Binary detection: 85-95% accuracy (with averaging)
- Inference: 15-25ms per epoch
- ITR: 10-20 bits/minute
- Class-specific covariances capture ERP morphology
- Better for overlapping distributions
- Handles individual differences
SSVEP (Steady-State Visual Evoked Potential)
Recommended Model: Bayesian LDA (RxLDA) or Bayesian GMM (RxGMM)- 4-target: 85-95% accuracy, use RxLDA
- 6+ target: 80-90% accuracy, use RxGMM
- Inference: 10-20ms per trial
- ITR: 30-50 bits/minute
- RxLDA: For 2-4 targets with well-separated frequencies
- RxGMM: For 6+ targets with overlapping harmonics
Paradigm Comparison
| Paradigm | Recommended Model | Typical Accuracy | ITR | User Training |
|---|---|---|---|---|
| Motor Imagery | RxLDA | 70-85% (4-class) | 15-25 bits/min | High |
| P300 | RxGMM | 85-95% (with reps) | 10-20 bits/min | Low |
| SSVEP | RxLDA/RxGMM | 85-95% (4-class) | 30-50 bits/min | Low |
Advanced Techniques
Hyperparameter Optimization
Use grid search or Bayesian optimization to find optimal hyperparameters:- Python
- Julia
Cross-Subject Transfer Learning
Train on multiple subjects for better generalization:Ensemble Methods
Combine multiple models for improved robustness:Confidence Calibration
Ensure predicted probabilities match actual accuracy:Model Limitations
Troubleshooting
Model Overfitting
Model Overfitting
Symptoms: High training accuracy, low test accuracySolutions:
- Increase
mu_scale(stronger regularization) - Use cross-validation for hyperparameter tuning
- Collect more training data
- Apply ensemble methods
Poor Cross-Subject Generalization
Poor Cross-Subject Generalization
Symptoms: Good within-subject, poor across-subject performanceSolutions:
- Train on multi-subject data
- Increase regularization (
mu_scale) - Normalize features consistently
- Use subject-specific calibration
Class Imbalance
Class Imbalance
Symptoms: Model biased toward majority classSolutions:
- Use class weighting
- Apply SMOTE or other resampling
- Adjust decision threshold
- Use stratified cross-validation
Next Steps
Bayesian LDA (RxLDA)
Fast, shared covariance classifier
Bayesian GMM (RxGMM)
Flexible, class-specific covariances
Bayesian Softmax (RxPolya)
Multinomial logistic regression
Basic Examples
Complete Python & Julia code
Advanced Applications
Calibration, adaptation, hybrid systems
Python SDK
sklearn-compatible classifiers
Development Philosophy: NimbusSDK provides battle-tested, production-ready models (Bayesian LDA, Bayesian GMM, Bayesian Softmax) that are proven effective for BCI applications. These models cover the majority of BCI use cases with fast inference, uncertainty quantification, and online learning.