[pymvpa] Dataset with multidimensional feature vector per voxel

Ulrike Kuhl kuhl at cbs.mpg.de
Thu Nov 26 15:49:26 UTC 2015


You can download the corresponding toy dataset using this link:
https://bigmail.cbs.mpg.de/i/b06cfdd4e67af51a4a75f404861ebe8b.hdf5 

----- Original Message -----
From: "kuhl" <kuhl at cbs.mpg.de>
To: "pkg-exppsy-pymvpa" <pkg-exppsy-pymvpa at lists.alioth.debian.org>
Sent: Thursday, 26 November, 2015 09:30:01
Subject: Re: [pymvpa] Dataset with multidimensional feature vector per voxel

(The mail with the dataset attached is still waiting for moderator approval since it extends the limit of 240 KB.)

The code producing the error:

##############################
# set up DS as we worked out before:
DS_noisy = setup_ds ( sub_list, param_list, data_path )

# define a partitioner 
npart = ChainNode([
  NFoldPartitioner(len(DS_noisy.sa['targets'].unique),
                         attr='chunks'),
  Sifter([('partitions', 2),
                ('targets',
                 { 'uvalues': DS_noisy.sa['targets'].unique,
                   'balanced': True})
                ]),
  Balancer(attr='targets',count=10,limit='partitions',apply_selection=False)
  ], space='partitions')

clf_noisy = LinearCSVMC()
cvte_noisy = CrossValidation(clf_noisy, npart,errorfx=lambda p, t: np.mean(p == t),enable_ca=['stats'],postproc=mean_sample())

sl  = Searchlight(
   cvte_noisy,
   IndexQueryEngine(   # so we look for neighbors in both space and across modality_index
       voxel_indices=Sphere(3),    # that is pretty much what sphere_searchlight(radius=3) does
       modality_index=Sphere(len(param_list))), # 1cover all parameter values!
   postproc=mean_sample(),
   enable_ca=['stats'],
   roi_ids=np.where(DS_noisy.fa.modality_index == 0)[0] # restrict it to search for "modality_index" neighbors only when we are looking at modality_index==0
)

res_noisy = sl(DS_noisy)
##############################


The last line returns the IndexError.

DS_noisy.summary() returns:

Dataset: 7x3472 at float32, <sa: chunks,subject,targets>, <fa: modality,modality_index,voxel_indices>, <a: imghdr,mapper>
stats: mean=0.516962 std=0.298723 var=0.0892352 min=9.75631e-06 max=1.78471

Counts of targets in each chunk:
  chunks\targets  0   1
                 --- ---
        0         1   0
        1         1   0
        2         1   0
        3         1   0
        4         0   1
        5         0   1
        6         0   1

Summary for targets across chunks
  targets  mean  std  min max #chunks
    0     0.571 0.495  0   1     4
    1     0.429 0.495  0   1     3

Summary for chunks across targets
  chunks mean std min max #targets
    0     0.5 0.5  0   1      1
    1     0.5 0.5  0   1      1
    2     0.5 0.5  0   1      1
    3     0.5 0.5  0   1      1
    4     0.5 0.5  0   1      1
    5     0.5 0.5  0   1      1
    6     0.5 0.5  0   1      1
Sequence statistics for 7 entries from set [0, 1]
Counter-balance table for orders up to 2:
Targets/Order O1    |  O2    |
      0:       3 1  |   2 2  |
      1:       0 2  |   0 1  |
Correlations: min=-0.75 max=0.42 mean=-0.17 sum(abs)=2.7



----- Original Message -----
From: "Yaroslav Halchenko" <debian at onerussian.com>
To: "pkg-exppsy-pymvpa" <pkg-exppsy-pymvpa at lists.alioth.debian.org>
Sent: Tuesday, 24 November, 2015 21:10:52
Subject: Re: [pymvpa] Dataset with multidimensional feature vector per voxel

On Tue, 24 Nov 2015, Ulrike Kuhl wrote:
> I was able to reproduce the error when using a mask (1736 voxels) on my toy data:

could you share the code snippet and this toy dataset (h5save it)?

> Traceback (most recent call last):
>   File "DummyMvpa_noisy.py", line 322, in <module>
>     res_noisy = sl(DS_noisy)
>   File "/usr/lib/python2.7/dist-packages/mvpa2/base/learner.py", line 259, in __call__
>     return super(Learner, self).__call__(ds)
>   File "/usr/lib/python2.7/dist-packages/mvpa2/base/node.py", line 121, in __call__
>     result = self._call(ds)
>   File "/usr/lib/python2.7/dist-packages/mvpa2/measures/searchlight.py", line 143, in _call
>     results = self._sl_call(dataset, roi_ids, nproc)
>   File "/usr/lib/python2.7/dist-packages/mvpa2/measures/searchlight.py", line 371, in _sl_call
>     results=self.__handle_all_results(p_results))
>   File "/usr/lib/python2.7/dist-packages/mvpa2/measures/searchlight.py", line 207, in _concat_results
>     results = sum(results, [])
>   File "/usr/lib/python2.7/dist-packages/mvpa2/measures/searchlight.py", line 527, in __handle_all_results
>     for r in results:
>   File "/usr/lib/pymodules/python2.7/pprocess.py", line 764, in next
>     self.store()
>   File "/usr/lib/pymodules/python2.7/pprocess.py", line 400, in store
>     self.store_data(channel)
>   File "/usr/lib/pymodules/python2.7/pprocess.py", line 747, in store_data
>     data = channel.receive()
>   File "/usr/lib/pymodules/python2.7/pprocess.py", line 135, in receive
>     obj = self._receive()
>   File "/usr/lib/pymodules/python2.7/pprocess.py", line 121, in _receive
>     raise obj
> IndexError: index 1736 out of bounds 0<=index<1736


> Why does the searchlight run out of the mask?

not sure yet

-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        

_______________________________________________
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa
-- 
Max Planck Institute for Human Cognitive and Brain Sciences 
Department of Neuropsychology (A219) 
Stephanstraße 1a 
04103 Leipzig 

Phone: +49 (0) 341 9940 2625 
Mail: kuhl at cbs.mpg.de 
Internet: http://www.cbs.mpg.de/staff/kuhl-12160

_______________________________________________
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa
-- 
Max Planck Institute for Human Cognitive and Brain Sciences 
Department of Neuropsychology (A219) 
Stephanstraße 1a 
04103 Leipzig 

Phone: +49 (0) 341 9940 2625 
Mail: kuhl at cbs.mpg.de 
Internet: http://www.cbs.mpg.de/staff/kuhl-12160



More information about the Pkg-ExpPsy-PyMVPA mailing list