You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Speed up LFC by 1.48x via Stage-1 subsample and joint Stage-2 fit
Three changes to _fit_glm_fast_per_perturbation in nb_glm_fast.py:
- Stage 1 max_iter reduced from 50 to 5 (NB) / 10 (Poisson)
- Stage 1 now fits on a random 3000-cell mixed (ctrl+pert) subsample
instead of all cells; column scaling and covariate offsets still use
all cells, preserving accuracy
- Stage 2 per-perturbation loop replaced by a single joint
fit_batch_with_joint_offsets(design=A) call, which is mathematically
equivalent for one-hot treatment designs (block-diagonal IRLS)
Validated on Replogle tutorial (79865 cells x 8563 genes, 200 perts,
14 batches): 146.9 min vs 217.5 min = 1.48x speedup; tau Pearson
r=0.9994, Jaccard=0.975, 221657 vs 222090 sig pairs (-0.2%).
Replogle tutorial notebook re-executed with optimized code: 149.2 min.
CHANGELOG updated under v0.0.6 Performance.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,29 @@ On synthetic data (n = 500, p = 200): 61.5× GLM fit speedup, 7.1× imputation s
112
112
113
113
Latent factor recovery: mean canonical correlation 0.998. LFC correlation: 0.856 (expected difference due to per-perturbation vs. joint model specification).
Three targeted changes reduce end-to-end `gcate_lfc_batch` wall time by **1.48×** on the Replogle tutorial dataset (79,865 cells × 8,563 genes, 200 perturbations, 14 batches):
The Stage 1 subsample uses a random draw of up to 3,000 cells from both control and perturbation cells; column scaling and covariate offsets still use all cells. The Stage 2 joint fit is mathematically equivalent to the original per-perturbation loop for one-hot treatment designs (block-diagonal IRLS normal equations).
137
+
115
138
## [0.0.5] - 2025-01-30
116
139
117
140
- GCATE model for gene-level causal effect estimation from CRISPR screens.
0 commit comments