PyMVPA / PyMVPA

MultiVariate Pattern Analysis in Python
http://www.pymvpa.org
Other
312 stars 135 forks source link

SearchlightHyperalignment is incapable of handling datasets with varying # of features #589

Open beausievers opened 6 years ago

beausievers commented 6 years ago

I have a dataset where one of the subjects is completely missing variance in data in one of the searchlights. That leads SearchlightHyperalignment to fail in ProcrusteanMapper

> /afs/dbic.dartmouth.edu/usr/pkg/python/python_v2.7/amd64_linux26/lib/python2.7/site-packages/mvpa2/mappers/procrustean.py(123)_train()
    122                                        * sn * means[i] )**2)):
--> 123                 raise ValueError, "For now do not handle invariant in time datasets"

but if I remove invariant features in the datasets, that leads them to have different # of features, and then it fails during forward mapping.

/afs/dbic.dartmouth.edu/usr/pkg/python/python_v2.7/amd64_linux26/lib/python2.7/site-packages/scipy/sparse/base.pyc in __mul__(self, other)
    403 
    404             if other.shape[0] != self.shape[1]:
--> 405                 raise ValueError('dimension mismatch')
    406 
    407             result = self._mul_multivector(np.asarray(other))

ValueError: dimension mismatch
mohmdrezk commented 4 years ago

Hi, by any chance, did you find a solution to this problem? I am having the same issue. Thank you in advance.

beausievers commented 4 years ago

I worked around this issue by adding very low amplitude Gaussian noise to the invariant features before calculating the hyperalignment maps. Seems to work just fine.

mohmdrezk commented 4 years ago

Thank you very much. I will give that a try. Best regards.

yarikoptic commented 4 years ago

Fwiw, please use mvpa2.seed in your script to make results reproducible

mohmdrezk commented 4 years ago

Thank you all. It worked fine. All the best.

soligschlager commented 2 months ago

Hi, I'm encountering the same issue and was wondering if you added the low amplitude Gaussian noise to the invariant features before or after zscoring? Many thanks in advance!