timeflux / timeflux_rasr

Implementation of rASR filtering.
MIT License
26 stars 4 forks source link

step_size _fit_eeg_distribution #19

Closed bertrandlalo closed 4 years ago

bertrandlalo commented 4 years ago

~/miniconda3/envs/timeflux-tutorials/lib/python3.7/site-packages/sklearn/pipeline.py in fit(self, X, y, fit_params) 352 self._log_message(len(self.steps) - 1)): 353 if self._final_estimator != 'passthrough': --> 354 self._final_estimator.fit(Xt, y, fit_params) 355 return self 356

~/PycharmProject/OpenMindInnovation/timeflux/timeflux_rasr/timeflux_rasr/estimation.py in fit(self, X, y) 183 184 for c in range(Ne): --> 185 dist_params[c, :] = _fit_eeg_distribution(rmssliding[:, c]) 186 self.threshold = np.diag(dist_params[:, 0] + self.rejection_cutoff * dist_params[:, 1]).dot( 187 np.transpose(evecs))

~/PycharmProject/OpenMindInnovation/timeflux/timeflux_rasr/timeflux_rasr/estimation.py in _fit_eeg_distribution(X, min_clean_fraction, max_dropout_fraction, quantile_range, step_sizes, beta_range) 357 raise ValueError('Unreasonable step sizes.') 358 if any(step_sizes n < 1): --> 359 raise ValueError(f"Step sizes compared to actual number of samples available, step_sizes n should be " 360 f"greater than 1 (current value={step_sizes * n}") 361 if any(beta_range >= 7) | any(beta_range <= 1):

ValueError: Step sizes compared to actual number of samples available, step_sizes * n should be greater than 1 (current value=[0.29 0.29]

lkorczowski commented 4 years ago

I'm looking into it.

lkorczowski commented 4 years ago

@bertrandlalo should be fixed, the parameters in RASR matters now. Sorry for this huge mistake. Please review #21 and valid PR if it is ok for you.

Please note than 1min is probably barely enough to have hundreds of intervals required in _fit_eeg_distribution(). With window_len is 3s and window_overlap 0.66, you should have about 29 epochs while we need at least 100 epochs in _fit_eeg_distribution. With window_len is 0.5s and window_overlap 0.66, you should have about 199 epochs which is just enough to estimate consistent statistics in _fit_eeg_distribution.

Considering at least, 1min30 (299 epochs) or 2min (399 epochs) should be much better.

if window_len is 3s, 5min (149 epochs) with 0.66 of overlap is minimum or you can increase window_overlap to 0.9 (191 epochs) with 1min.

lkorczowski commented 4 years ago

Also, in #21 , I've corrected window_overlap to match description and added sanity check.

lkorczowski commented 4 years ago

For Sprint3 (#15 ):

Is that a good strategy ?