nilearn icon indicating copy to clipboard operation
nilearn copied to clipboard

consider "caching" compute_contrast results in GLM models

Open Remi-Gau opened this issue 1 year ago • 2 comments

I doubt I am the first one to think of it, so is there any reason why results from compute_contrast have to be recomputed every time the method is called rather than keeping track of contrasts that have already been computed and we re accessing them?

@bthirion @emdupre

Remi-Gau avatar Apr 04 '25 09:04 Remi-Gau

Sorry, I'm less familiar with this part of the code base, so just to make sure : Are you referring to this issue, where make_stat_maps is repeatedly calling compute_contrast ? Or do you mean within compute_contrast itself things are being called repeatedly ?

emdupre avatar Apr 04 '25 17:04 emdupre

IIUC in many practical cases, contrasts are computed several times, at least twice, for reporting and to write them on disk. Indeed caching would help here.

bthirion avatar Apr 04 '25 20:04 bthirion