Skip to content

Dev rf glm fast sta - #82

Merged
jonathanoesterle merged 11 commits into
mainfrom
dev-rf-glm-fast-sta
Oct 30, 2026
Merged

jonathanoesterle merged 11 commits into
mainfrom
dev-rf-glm-fast-sta

Conversation

@jonathanoesterle

Copy link
Copy Markdown
Collaborator

No description provided.

jonathanoesterle and others added 10 commits October 29, 2026 14:03
- Skip insert in make when no RFs were computed
- Make snr nullable in quality table, insert None instead of NaN
- Select the single params set via key_source so populate can be restricted by field etc.
- Warn and use overlapping part when stimulus length differs from design matrix
- Remove duplicate fit_kind fetch, unused best_pixel, stale comments; use tqdm.auto

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add whiten and whiten_reg params to FastStaParamsTemplate. When enabled, the
STA is multiplied by the ridge-regularized inverse stimulus covariance,
computed once per parameter set. Includes tests for the whitening helper.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
RfGlmParamsTemplate/RfGlmTemplate now subclass the FastSta templates: the
design matrix is built once per stimulus and stored in the params table, and
traces are aligned to the stimulus directly (no DNoiseTrace). Only the fit
step is replaced, via a new FastStaTemplate._compute_entry hook.

- ReceptiveFieldGLM takes a precomputed design matrix (from_stim keeps the
  old raw-stimulus interface); permutation test now permutes the trace
- Remove RfGlmSingleModelTemplate; quality table keys on the GLM table
- Breaking: RfGlm primary key changes, existing tables must be recomputed
- Fix build_design_matrix for 1D stimuli and np.NINF with numpy 2

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Split core_schema into blocks (core, basic, location, classifier, rf_sta, rf_glm)
  with matching percent-format notebook parts.
- make_user.py builds a personal schema and tutorial .ipynb (jupytext) from the
  selected blocks; the notebook is safe for Run all.
- Add STA tables to rf_glm_schema.
- Add jupytext extra, .flake8 and tests for the generator.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Port the fork-only GLM features (pre-computed design matrices, fit_R,
fit_intercept, fit_hps, early stopping) into a subclass of rfest.GLM in
djimaging, so the official rfest package can be used. jax/rfest are
imported lazily, only when a GLM is fit.

Also fix float() on 1-element arrays and unset df_ws for non-spatial
stimuli in glm_utils, port generate_data_3d_stim into the tests, make
FastSta restrict the params table by primary key only, and update the
populate test stub to the current FastSta table contract.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Use DataJoint's tripartite make for FastSta/RfGlm, so the RFs are computed
  outside of the database transaction and long computations no longer lose
  the connection. make_fetch returns a digest-hashed object, because
  DataJoint's hash of the fetched traces is very slow.
- FastSta: compute the STAs of all traces of a presentation with a single
  matrix product.
- RfGlm: project the design matrix onto the spline bases once per populate,
  run the Adam optimization in compiled chunks that are cached across fits,
  and fit the traces of a presentation in parallel processes.
- Add `n_jobs` to populate (default 30) to set the number of CPU cores.
- Fix RfGlm with kfold=1 and several dfs returning the model of the last df
  instead of the best one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Change the RfGlmParams defaults to a single fit on all data (kfold=0,
  frac_test=0, one df and beta, random init), which is fast and gives
  reasonable RFs.
- RfGlmQuality: without test data, skip the permutation test and use the
  train scores only. Raise a clear error if no quality criterion applies.
- Clip df_ts/df_ws once in prepare_sta_params and pass the clipped values to
  the fits, so the clipping warning is shown once instead of once per trace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…otebooks

Generated notebooks are named populate_<project>_schema and the schema name
is ageuler_<login>_<project>. Project names must be valid python identifiers
since they are part of the import path. Document the table block logic.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jonathanoesterle jonathanoesterle assigned Copilot and unassigned Copilot Oct 30, 2026
@jonathanoesterle
jonathanoesterle merged commit 5ba2608 into main Oct 30, 2026
4 checks passed
@jonathanoesterle
jonathanoesterle deleted the dev-rf-glm-fast-sta branch October 30, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants