Skip to main content

Python SDK

The nimbus-bci Python library provides sklearn-compatible Bayesian classifiers for Brain-Computer Interface applications. Built on JAX and NumPyro, it delivers fast probabilistic inference with full uncertainty quantification, streaming support, and rich diagnostics.

Overview

nimbus-bci is a production-ready Python package available on PyPI that brings Bayesian inference to BCI applications with a familiar sklearn-compatible API.
pip install nimbus-bci

Key Features

sklearn Compatible

Drop-in replacement for sklearn classifiers. Works with pipelines, cross-validation, and GridSearchCV.

Streaming Inference

Real-time chunk-by-chunk processing for online BCI applications with weighted aggregation.

MNE Integration

Seamless integration with MNE-Python for EEG preprocessing and feature extraction.

Rich Diagnostics

Entropy, calibration metrics (ECE/MCE), ITR calculation, and quality assessment.

Online Learning

Update models incrementally with partial_fit() without retraining from scratch.

Fully Local

No API keys required. All processing happens on your machine for maximum privacy.

Quick Example

from nimbus_bci import NimbusLDA
import numpy as np

# Create and fit classifier
clf = NimbusLDA()
clf.fit(X_train, y_train)

# Predict with uncertainty
predictions = clf.predict(X_test)
probabilities = clf.predict_proba(X_test)

# Works with sklearn pipelines
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler

pipe = make_pipeline(StandardScaler(), NimbusLDA())
pipe.fit(X_train, y_train)

Available Classifiers

The Python SDK provides three Bayesian classifiers:
ClassifierDescriptionBest For
NimbusLDABayesian LDA with shared covarianceFast, well-separated classes (motor imagery)
NimbusGMMBayesian GMM with class-specific covariancesComplex distributions (P300)
NimbusSoftmaxBayesian logistic regression (Polya-Gamma VI)Non-Gaussian decision boundaries
All classifiers provide:
  • Full posterior distributions
  • Uncertainty quantification
  • Online learning via partial_fit()
  • sklearn-compatible API

Python vs Julia SDK

Both SDKs implement the same Bayesian models but with different design philosophies:
FeaturePython SDKJulia SDK
Installationpip install nimbus-bciPkg.add("NimbusSDK") + API key
API Stylesklearn-compatible classesFunctional + types
Integrationsklearn pipelines, MNE-PythonRxInfer.jl ecosystem
PerformanceFast (JAX/NumPyro)Fastest (native Julia)
API KeyNot requiredRequired
Use CaseProduction ML pipelinesResearch, custom models
LicenseProprietary (free evaluation)Commercial tiers

When to Use Python SDK

Choose the Python SDK if you:
  • ✅ Work primarily in Python
  • ✅ Use sklearn pipelines and MNE-Python
  • ✅ Want immediate installation without API keys
  • ✅ Need sklearn-compatible API for easy integration
  • ✅ Prefer fully local processing

When to Use Julia SDK

Choose the Julia SDK if you:
  • ✅ Need maximum performance (native Julia)
  • ✅ Want to build custom Bayesian models
  • ✅ Work with RxInfer.jl ecosystem
  • ✅ Need pre-trained model distribution
  • ✅ Require enterprise support

Architecture

EEG Data → MNE-Python → nimbus-bci → Your Application
           (Preprocessing)  (Classification)  (Control/Analysis)
Key Design Principles:
  • Local Processing: All computation happens on your machine
  • Privacy First: Your EEG data never leaves your computer
  • sklearn Compatible: Works with existing ML workflows
  • Fast Inference: JAX-compiled for performance
  • Uncertainty Aware: Full Bayesian posterior distributions

Use Cases

Motor Imagery BCI

Control devices with imagined movements using CSP features and NimbusLDA

P300 Speller

Communication interfaces using ERP features and NimbusGMM

Real-time Neurofeedback

Streaming inference for live brain state monitoring

Research Pipelines

sklearn-compatible API for reproducible BCI research

What’s Included

The nimbus-bci package provides: Classifiers:
  • NimbusLDA - Bayesian Linear Discriminant Analysis
  • NimbusGMM - Bayesian Gaussian Mixture Model
  • NimbusSoftmax - Bayesian Multinomial Logistic Regression
Data Structures:
  • BCIData - Container for features, metadata, labels
  • BCIMetadata - Metadata for BCI experiments
Inference:
  • predict_batch() - Batch inference with diagnostics
  • StreamingSession - Real-time chunk processing
Metrics:
  • compute_entropy() - Prediction uncertainty
  • compute_calibration_metrics() - ECE/MCE
  • calculate_itr() - Information Transfer Rate
  • assess_trial_quality() - Quality checks
Utilities:
  • estimate_normalization_params() - Feature normalization
  • diagnose_preprocessing() - Preprocessing diagnostics
  • compute_fisher_score() - Feature discriminability
MNE Integration:
  • from_mne_epochs() - Convert MNE Epochs to BCIData
  • extract_csp_features() - CSP feature extraction
  • extract_bandpower_features() - Bandpower features

Next Steps

Support

Need help? We’re here for you:
Ready to get started? Head to the Installation Guide to install nimbus-bci.