pillowlab / BinaryPursuitSpikeSorting

Detect synchronous and overlapped spikes in extracellular recordings using Binary Pursuit (Pillow et al 2013)
MIT License
13 stars 7 forks source link

low spike counts per chunk lead to ill-conditioned regression problem #1

Open pmeier82-zz opened 9 years ago

pmeier82-zz commented 9 years ago

Concerning the template estimation, if there happen to be very few to zero spikes for one of the units, the regression problem will be ill-conditioned or even singular. This seems to be a general problem, do you have any pointers how to treat the issue?

Thanks, Phil

jpillow commented 9 years ago

Hi Phil,

Yes, that's absolutely right! (!lthough I have to say that's never happened in any of the datasets I've examined -- generally we get far more spikes than we have samples in the waveform...). But if you had < 20 spikes then indeed the ML regression estimate for the 20-bin spike waveform (e.g.) would be undefined, and would probably be badly ill-conditioned if you had slightly more than 20 spikes.

In this case, the simplest thing would be ridge regression, but you could also try out regularizers based on smoothing (e.g., penalize likelihood with the sum of squared differences between neighboring waveform coefficients). Hope that helps!

best, Jonathan

On Wed, Jan 21, 2015 at 6:00 AM, Philipp Meier notifications@github.com wrote:

Concerning the template estimation, if there happen to be very few to zero spikes for one of the units, the regression problem will be ill-conditioned or even singular. This seems to be a general problem, do you have any pointers how to treat the issue?

Thanks, Phil

Reply to this email directly or view it on GitHub https://github.com/pillowlab/BinaryPursuitSpikeSorting/issues/1.

pmeier82-zz commented 9 years ago

Yes, I work on artificial data that has systematically generated near-synchronous events (overlapping spikes). Due to the generation process (walking over pairings), there is a strong bias on the label distribution within a chunk.

I was adjusting the regression step using pinv as a naive workaround. Visual inspection shows some ringing in the estimated templates, so I might have look into regularisation as you suggested.

Questions: Ridge regression = spherical regularizer? Smoothness would be something like diag(ones(n,1),0)-diag(ones(n-1,1),1) ?

jpillow commented 9 years ago

Hi Phil,

Yes, for ridge regression the regular corresponds to a quadratic form w'_C_w, where C = lambda * eye(n), with lambda the ridge parameter.

For smoothness, you can do D = spdiags(ones(n,1)_[-1 1],0:1, n-1, n); % this is the matrix that computes differences between adjacent coefficients (i.e., for vector of coefficients). C = lambda * D'_D; % Computes squared differences, with "strength" of regularization determined by lambda.

best, Jonathan

On Thu, Jan 22, 2015 at 7:35 AM, Philipp Meier notifications@github.com wrote:

Yes, I work on artificial data that has systematically generated near-synchronous events (overlapping spikes). Due to the generation process (walking over pairings), there is a strong bias on the label distribution within a chunk.

I was adjusting the regression step using pinv as a naive workaround. Visual inspection shows some ringing in the estimated templates, so I might have look into regularisation as you suggested.

Questions: Ridge regression = spherical regularizer? Smoothness would be something like diag(ones(n,1),0)-diag(ones(n-1,1),1) ?

Reply to this email directly or view it on GitHub https://github.com/pillowlab/BinaryPursuitSpikeSorting/issues/1#issuecomment-71014092 .