Skip to main content
Python: NimbusLDA | Julia: NimbusLDA, a different implementation on RxInfer.jl — see the Julia API reference
Mathematical model: Normal-Inverse-Wishart posterior over class means and one shared precision; Student-t predictive
NimbusLDA is the default head. It assumes the classes share one covariance, which makes it the fastest of the heads and the right first choice for motor imagery, where two or four well-separated classes are the common case. Its probabilities are read from the posterior, so they carry how much evidence sits behind them.
Python Personalizer head: the default — Personalizer(head="lda"), or Personalizer.for_deployment(enc, classes). On this head fit_calibrated fits a certificate. See Trust & calibration.

Quick start

sklearn-compatible: it drops into make_pipeline(StandardScaler(), NimbusLDA()), cross_val_score, and GridSearchCV like any classifier.

When to use NimbusLDA

  • Motor imagery with two to four classes whose covariance structure is similar across classes.
  • You want the cheapest online update: partial_fit is a conjugate update, about 87 µs against ~835 µs for a sklearn LDA refit — see Why Bayesian BCI Inference.
  • A calibration set of a few dozen trials per class; the prior carries the estimate when the data is thin.

When not to use it

  • The classes have clearly different covariances — P300 target versus non-target often does. Use NimbusQDA.
  • The boundary is not Gaussian — a multiclass problem with non-linear structure. Use NimbusSoftmax.
  • Features outnumber trials many times over — a frozen trunk’s embeddings with a few dozen labelled trials. The head no longer collapses there (see below), but NimbusProbit is built for that regime and is better calibrated.
  • The session drifts in a structured way. Use NimbusSTS.

Model

One shared precision matrix W across the classes; a class conditional p(x | y = k) = N(mu_k, W⁻¹); conjugate Normal-Inverse-Wishart priors, so the posterior is closed-form and partial_fit is exact. Predictions integrate over the posterior, which gives a multivariate Student-t predictive rather than a plug-in Gaussian — the difference between “the mode says 0.9” and “the evidence says 0.9”. When a class has n_k trials, its posterior mean sits n_k / (n_k + kappa0) of the way from the prior mean to the sample mean: the fewer the trials, the more the prior holds it back.

Hyperparameters

When the calibration set has fewer within-class degrees of freedom than features, the sample covariance is singular. The head’s prior scatter is then the OAS-shrunk estimate, so it stays positive definite and the head stops returning a uniform distribution for every trial — the defect fixed in 0.10.0. kappa0 (0.10.0) is the one worth tuning when features outnumber trials: it is better calibrated than the default there. A plain LogisticRegression is still more accurate.

The gate behind it

The fixed gate — a confidence floor of 0.6 and an entropy ceiling — promised nothing and delivered little: within a session on BNCI2015-001 it sent 25–93 % of the test trials with 4.7–26.2 % of all trials wrong commands, and the pinned accept rate sent 63–70 % with 12.1–20.0 % wrong (cell S22, read once). So this head lets a certificate decide.
The risk gate kept wrong commands at 0.048–0.098 of all trials from 8 held-out trials per class on, sending 0.32–0.57 of the trials; at 4 per class on two classes nothing is certified at alpha 0.1. Without a certificate the fixed gate stays and BrainState.extras["gate_calibrated"] is False. Details: Trust & calibration.

Model inspection

Model selection context

What was measured head against head — LDA, QDA and Softmax on the same corpora, and where plain logistic regression wins: Evidence.

Next read

Personalizer

This head behind wrap → Personalizer → BrainState.

Trust & calibration

The certificate that decides in front of this head.

sklearn Integration

Pipelines, cross-validation and tuning with the heads.

Evidence

LDA against QDA, Softmax and logistic regression.