thomasdeneux / spikes

spike extraction from calcium signals (Deneux et al., 2016)
5 stars 9 forks source link

running times #4

Open marius10p opened 7 years ago

marius10p commented 7 years ago

Hi, I could not find in the paper any indication of running times. Was hoping you could give me a rough idea, since it is critical for my application. For example, how long would it take to deconvolve 10,000 cells, recorded at 3Hz, for 2 hours. Do you have any recommendations for accelerating it?

Many thanks, Marius

thomasdeneux commented 7 years ago

Hello Marius,

In general, MLspike is faster than other model-based methods (e.g. Vogelstein et al, 2009), yet slower than direct linear methods (e.g. Theis et al, 2016). As a rule of thumb, it would be real time for a single cell recorded at 1kHz, when applied with default settings and on a modern desktop computer. Thus for 10,000 cells recorded at 3Hz, it would take 30 times the recording time (2 days and a half for 2 hours of recordings, i.e. at the limit of acceptability).

If the data was acquired at high frequency, downsampling could reduce computational cost by a factor equal to the downsampling factor, without major harm down to 10~15Hz. But in your case with recordings at 3Hz, downsampling is not an option.

You can gain a factor 2 to 5 by making the discretization grid coarser (i mean discretization of calcium concentrations and baseline values, in the substructure of parameters par.algo), possibly at the expense of reconstruction quality. Furthermore, if you have very stable recordings (no baseline fluctuation) and have good heuristics to estimate the baseline, you can set a fixed value for the baseline (parameter par.F0) and gain in total up to a factor 10.

Further improvements of MLspike would include sparse representations of the probability distributions and hence could cut significantly the computational costs. This might come in the future!

Best, Thomas