sccn / clean_rawdata

Cleaning Raw EEG data
GNU General Public License v3.0
42 stars 17 forks source link

Update vis_artifacts.m #8

Closed rgougelet closed 4 years ago

rgougelet commented 4 years ago

Computes scales 2x faster with 99.9% accuracy Test code:

d = randn(64,500*60*60); % 64 chans, 60 mins, 500hz
tic; orig = 2*mad(d',1)'; toc;
tic; faster = 2*mad(quantile(d',1000),1)'; toc;
mean((faster-orig)./orig)
arnodelorme commented 4 years ago

@chkothe do you agree with the change. It looks fine to me, but I do not understand why you would have used the quantile function in the first place.

rgougelet commented 4 years ago

quantile downsamples while preserving scale

arnodelorme commented 4 years ago

So the change might work well for data that is uniform but not so much when there are outlier values?

On Jan 25, 2020, at 13:15, rgougelet notifications@github.com wrote:

 quantile downsamples while preserving scale

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

rgougelet commented 4 years ago

My impression is that quantile used in this way downsamples the distribution of the data, so it will preserve the influence of outliers/the shape of the distribution. It destroys the temporal information but we're only interested in scale anyway.