MountainSort5: expose `pca_seed` / `random_seed` sorter param (pair with MS5 configurable PCA seed)

Aperta
#4,919 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
43/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Start with src/spikeinterface/sorters/external/mountainsort5.py, especially the whitening_seed parameter and _params_description; check the current MountainSort5 Scheme parameter objects and issue #69 to confirm seed support before forwarding it. Then review the sorter documentation and existing MountainSort5 tests to identify where to document and check reproducibility. Done means a seed parameter is passed through, its distinction from whitening_seed and threading caveats are documented, and a small seeded-run test is added.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

si.run_sorter('mountainsort5', ...) already accepts whitening_seed and forwards it to whiten(seed=...) (#4600). There is no analogous parameter for MountainSort5's internal PCA / clustering RNG.

Callers who need deterministic, seed-controlled sorts currently set process-global np.random.seed / random.seed before run_sorter, force n_jobs=1 + single-threaded BLAS, and hope MS5 / sklearn honor the ambient RNG. That is fragile:

  • On mountainsort5 < 0.5.9, unseeded PCA() can follow the ambient NumPy RNG.
  • On mountainsort5 ≥ 0.5.9, PCA hardcodes random_state=0, so ambient seeding no longer changes PCA output.

Proposal

Depends on exposing a seed in MountainSort5 itself (https://github.com/flatironinstitute/mountainsort5/issues/69).

  1. Add a sorter param next to whitening_seed in src/spikeinterface/sorters/external/mountainsort5.py (suggested name: pca_seed or random_seed; default matching MS5, likely 0).
  2. Forward it into the Scheme1/Scheme2(/3) parameter objects once MS5 supports it.
  3. Document in _params_description and the sorter docs that:
    • this controls MS5 PCA / classifier PCA RNG;
    • whitening_seed is separate (SI whitening before MS5);
    • n_jobs > 1 / multi-threaded BLAS can void bit-identical reproducibility.
  4. Add a small test: two runs with the same seed agree on spike trains (or unit count + spike counts on a tiny recording); a different seed can differ (if feasible in CI time).
Optional follow-ups (not required for this PR)
  • Persist the effective seed into sorting-folder / provenance metadata.
  • A top-level seed= on run_sorter that fans out to sorter-specific kwargs when supported.
  • A short “deterministic sorting” recipe in the docs (seed + spawn/mp_context + threadpool_limits(1)).

I can open a PR once the MS5 parameter lands (or against a known MS5 commit if maintainers prefer).

Context

We rely on reproducible MS5 sorts for parameter sweeps and for re-running a chosen configuration with a content fingerprint of the spike trains. An explicit sorter kwarg would make that a supported SpikeInterface path instead of ambient RNG.

Lingua principale
Python
Stelle
870
Fork
284
Merge medio
3g 1h
PR unite (30g)
41

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SpikeInterface/spikeinterface

Tutte le issue di SpikeInterface/spikeinterface

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.