Repository navigation
v0.1.0
[0.1.0]
Inference fix for small perturbation arms, and the GLM engine moves to crispyx
(>= 0.1.5 now required).
Changed
- crispyx >= 0.1.5 is required.
causarray/glm_onehot.py, the two-stage
per-perturbation fitter and the design preconditioner are removed in favour
of crispyx'sStructuredGLMBatchFitterand dense batch fitter, which agree
with the statsmodels path to 2e-5 on well-conditioned genes. fit_glm_autoroutes on gene count only (_FAST_MIN_P = 10), with the
_FAST_MAX_COEFdivergence check falling back to statsmodels.- Fitted means are no longer floored at
min_mu = 0.5, which biased genes
below about one count per cell. LFCuses the influence-function variance (usevar='pooled') only; the
Welch'unequal'variance overstated standard errors.- Propensity scores default to calibrated probabilities
(class_weight=None);'balanced'remains available. ps_clipdefaults to'auto', a prevalence-aware bound per treatment;
resolved bounds are returned asestimation['ps_clip_bounds'].LFCdefaultthres_min='auto'tests a gene only when aboutmin_counts
(default 5) counts are expected in the smaller arm.
Added
- A Poisson variance floor
1/(n1*tau1) + 1/(n0*tau0)inLFC, so chance
all-zero arms of sparse genes are not called while complete knockouts stay
significant (var_flooredcolumn). - Small-sample correction for
K=1: variance scaled byn/(n-d)and a t
reference withn-ddegrees of freedom. - Per-pair support columns
n_treated,n_control,count_treated,
count_controlandstd_rawin everyLFCresult. RuntimeWarnings for arms under 200 cells hitting the variance floor, and
forbackend='fast'without crispyx.tune_penalty_factorpicks the smallest per-treatment L2 penalty on one
propensity covariate that meets a support target, checking the
dropped-covariate limit first to detect infeasible treatments.gcate_lfc_batch(save_nuisances=True)saves each batch's outcome-model
predictions to<cache_path stem>.nuisances.h5for re-estimation under a
different propensity model; budget about
8 * n_cells * n_genes * n_treatmentsbytes per batch.estimate_racceptsbackendand returns atime_scolumn.
Performance
- Designs with one-hot treatment blocks are solved by a Schur complement,
flat in the number of treatments (n = p = 3,000: 5.1 s with 10 treatments,
7.7 s with 200). - GCATE's objective and gradients use parallel numba kernels with a fixed
reduction order (results independent of thread count); one update on a
3,000 x 3,000 problem drops from ~2.3 s to 0.5 s. estimate_rfits the initial[X | A]GLM once for all candidater.
Fixed
- NB dispersion falls back to the per-gene
estimate_dispwhen no batched
estimate is available, instead of a fixed size of 1. estimate_dispandfit_glmacceptoffset=False.fit_glmwith several treatments andimpute=Falsereturned zero
coefficients.mem_limit_gbis honoured on every imputation route.fit_glm_ondiskdrops cells with no counts (with a warning) instead of
returningNaNcoefficients.
Deprecated
LFC(usevar='unequal')is an alias of'pooled'and warns.LFC(eps_var=...)is ignored; the variance floor supersedes it.