Optimize the surround predictors in fitB's baseline estimate

Aperta
#41 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à
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Attiva
Ambito
data

Direzione di ricerca

Start in dependencies/extraction/extractTrial.m, where fitB calls getSurround, and read setParamsExtractTrial.m for params.Bfilter and the ±10·mean(Y) bounds. The issue lists several alternative designs and no chosen one, so agree on an approach with the maintainers first. Done means the paired short-trial denoised r and the real-trial RSS drop, coherence and bound-fraction checks all move in the intended direction.

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

Descrizione

enhancement

Background

fitB (dependencies/extraction/extractTrial.m) fits each pixel's baseline jointly with three surround predictors. They are meant to capture fast background fluctuations shared with neighbouring pixels. getSurround builds them by filtering the high-passed residual (Y − HX, high-passed by splitFreq) with the filters in params.Bfilter (setParamsExtractTrial.m):

  1. a ring, max(0, G(σ = selRadius) − G(σ = selRadius/2)), positive from about 5.7 px out at selRadius = 6;
  2. that ring times a left–right gradient mask;
  3. that ring times an up–down gradient mask.

Each pixel gets its own coefficient for each predictor. The coefficients are bounded at ±10·mean(Y), like the other baseline coefficients.

These notes come from the baseline-model work in #37 and #40. #40 keeps the surround unchanged, because removing it costs a little accuracy. But it looks under-used, and there are clear things to try.

What it contributes now

Short-trial ground truth. These are the 12 simulations, cut into 30 s trials with the real 780125 trial-end gaps imposed (the harness described in #40). Removing the surround predictors changes denoised r by:

  • −0.0019 per source with the sine basis (24 sources better, 74 worse by more than 0.005);
  • −0.0015 with the penalized spline from #40 (26 better, 78 worse).

LS r and event F1 barely change.

Real data. I dumped 65 fitB calls from 780125 trials (T = 5633 at 200 Hz) and refitted each with and without the surround (sine basis):

  • It explains little. The median fractional drop in weighted RSS is 0.0010 (10th–90th percentile 0.0006–0.0017). That is about twice what 3 extra predictors give by chance (3/T = 0.0005).
  • It changes LS traces slightly. The fast part moves by 0.08 noise SD (0.03–0.15), about 1.3% of F0.
  • No activity leaks into it on average. The correlation between the change in LS and the source's activity has a median of 0.00.
  • It is incoherent across pixels. Within a subproblem, the surround contributions of different pixels correlate at a median of 0.02.
    • The exception is one single-source subproblem, where they correlate at 0.54 and rise with bursts of activity.
    • There it explains 15× chance (RSS drop 0.0075) and moves LS by 0.37 noise SD.
    • Its correlation with activity is −0.20, so it lowers LS when the source is active. That may be real neuropil or out-of-focus signal, or it may be removing real signal.

The 10 dumps from the long simulations (T = 78260) look the same: RSS drop 0.0001 against 0.00004 by chance, and coherence 0.06.

Cost. Since #37 the surround is a sparse pixels × pixels product, and cheap. Before #37 it was most of fitB's time on long trials.

Why it is probably under-used

  1. Most of the ring lies outside the subproblem. A subproblem only holds pixels within selRadius of its sources (imdilate(..., strel('disk', selRadius)) & selPix), and getSurround treats everything else as zero. On the real dumps, the median share of the ring's weight that lands on pixels inside the subproblem is:

    • 13% for single-source subproblems;
    • 35% for subproblems with 4 or more sources;
    • 5–40% across all 65.

    So the predictor mostly sees the subproblem's own pixels near the sources, not the surround.

  2. The coefficient bounds are on the wrong scale. A surround coefficient is dimensionless: the pixel's fast fluctuation per unit of filtered residual. Its bound, ±10·mean(Y), is in photons per sample.

    • With the median mean(Y) of 0.57, the bound is about ±6.
    • The ring's weight inside the subproblem sums to only about 0.06 (median over pixels; 0.445 in total).
    • So following a fluctuation shared by the whole neighbourhood would need a coefficient of about 17.

    On the real trials, a median of 27% of surround coefficients sit at a bound (7–50% across subproblems). On the long simulations it is about 10%.

  3. Independent per-pixel coefficients fit noise. Each pixel fits three coefficients on its own, which gives contributions that are incoherent across pixels (r ≈ 0.02). A truly shared background would give coherent contributions.

Things to try

  • Feed the surround from outside the subproblem. Give each subproblem a wider ring of pixels (for example selPix dilated by another selRadius), used only to build the surround.
    • Their residual needs HX for sources that belong to neighbouring subproblems.
    • One option is to high-pass Y directly at pixels outside every footprint. Another is to use the previous iteration's estimates.
  • Normalize the predictors. Divide each surround predictor by its filter weight inside the subproblem, or by its SD. Coefficients then mean the same thing in every pixel, and bounds of a few units make sense, independent of mean(Y). A ridge penalty could replace the bounds.
  • Share the fast background across the subproblem. Fit one or a few fast background time courses per subproblem, with per-pixel loadings, instead of three independent coefficients per pixel. That uses far fewer free parameters and is coherent by construction.
  • Watch for activity leakage. A wider or less constrained surround could take on more of the coherent, activity-correlated component seen in the one subproblem above. Check the correlation between the change in LS and activity.
  • Check what the simulations contain. If they have no fast, spatially shared background, ground truth can only show what the surround costs, not what it gains. It is worth checking before relying on the short-trial harness to judge changes here.

How to evaluate

  • Short-trial ground truth: paired per-source denoised r, overall, near trial ends and in the interior.
  • Real trials: RSS drop against chance, coherence across pixels, the fraction of coefficients at a bound, and the correlation between the change in LS and activity.

The short-trial harness and the dump analysis behind these numbers aren't in the repo yet.

Lingua principale
MATLAB
Stelle
3
Fork
3
Merge medio
1g 22h
PR unite (30g)
31

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 AllenNeuralDynamics/GIAnT-MATLAB

Tutte le issue di AllenNeuralDynamics/GIAnT-MATLAB

Issue simili

Altre issue su MATLAB

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.