All work
IndependentMachine LearningResearch

Neural Decoder for Behavioral Choice

Decoding left vs. right choices from Neuropixels population activity (Steinmetz 2019) with PCA, logistic regression, and permutation testing.

Organization
Independent · Steinmetz / DANDI 000017
Timeline
2025
My role
End-to-end analysis: firing-rate features, PCA, decoder, null tests, and figures.

The problem

Neuropixels recordings give hundreds of simultaneously recorded neurons — noisy, correlated, and high-dimensional. The question: can left vs right choice still be decoded above chance from a short post-stimulus window, without pretending the decoder is a causal circuit map?

Why it matters

Shows whether behaviorally relevant structure lives in a low-dimensional neural subspace. Cross-validation alone is not enough; a permutation null asks whether the effect beats chance label structure.

Data & inputs

  • Steinmetz et al. 2019 — Mouse Richards session from DANDI 000017.
  • 778 neurons × trial firing rates in a 0–300 ms post-stimulus window.
  • 174 left/right choice trials after filtering for analyzable behavioral outcomes.

Approach

Build a trial × neuron firing-rate matrix → PCA to compress correlated population activity → L2-regularized logistic regression on the top principal components → 5-fold cross-validated ROC-AUC, plus a 500-shuffle label-permutation null to estimate chance.

  1. 01Firing rates174 trials × 778 neurons
  2. 02PCALow-dimensional neural modes
  3. 03DecodeL2 logistic regression
  4. 04ValidateCV + 500× permutation null

My contribution

  • Implemented the full decoding pipeline from firing-rate features through figures.
  • Chose PCA + L2 logistic regression to control overfitting with 778 features and only 174 trials.
  • Ran a 500-iteration label permutation test so “above chance” is quantified, not assumed.
  • Swept principal-component count and showed performance saturates around ~11 PCs.

Technical details

  • Primary metric: ROC-AUC for ranking left vs right trials (reported with fold mean ± std).
  • Secondary metric: classification accuracy under the same CV splits.
  • Null distribution mean AUC ≈ 0.505 — confirms the chance baseline sits at ~0.50.
  • Regularization and dimensionality reduction are required; raw-rate decoding overfits in this regime.

Challenges & decisions

  • p ≫ n features vs trials — without PCA, the classifier memorizes noise.
  • Population correlations mean many neurons carry overlapping information; the useful subspace is smaller than 778.
  • Decoding choice is not the same as identifying a specific causal circuit.

Results

  • ROC-AUC 0.884 ± 0.025; accuracy 0.799 ± 0.039 under 5-fold CV.
  • Permutation p-value < 0.0001 versus the label-shuffled null (mean null AUC ≈ 0.505).
  • Decoder performance saturates near ~11 principal components — most usable signal lives in a compact subspace.
Neural decoder ROC and permutation-null results
Decoder ROC-AUC vs chance from the label-permutation null.

Limitations

Single subject / session analysis. Decoding behavioral choice is not a claim about a specific causal circuit or generalizes across mice without further sessions.

What I learned

Cross-validation measures stability; permutation testing asks whether the effect beats chance. Both belong in a decoding write-up.