[pymvpa] Pkg-ExpPsy-PyMVPA Digest, Vol 114, Issue 6
Regina Lapate
lapate at gmail.com
Sat Sep 16 04:09:16 UTC 2017
Hi Nick:
Thanks very much for your helpful reply; the operations I wanted to do were
of the first type (e.g. shuffling samples of a particular target and chunk
type) and all is working now (using the indices).
Cheers,
Regina
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 9 Sep 2017 14:03:55 +0200
> From: Nick Oosterhof <n.n.oosterhof at googlemail.com>
> To: Development and support of PyMVPA
> <pkg-exppsy-pymvpa at lists.alioth.debian.org>
> Subject: Re: [pymvpa] additional data shuffling/cleaning after loading
> up data using fmri_dataset
> Message-ID: <5FFA9939-0D8B-4534-AC63-01EBCB47F06D at googlemail.com>
> Content-Type: text/plain; charset=us-ascii
>
>
> > On 9 Sep 2017, at 06:28, Regina Lapate <lapate at gmail.com> wrote:
> >
> > --Can one do regular python operations such as shuffling trials (or
> excluding trials with extreme outlier values) after loading up a dataset
> (nifti & targets) using mvpa2.datasets.mri.fmri_dataset?
> >
> > I assumed so, but upon trying to shuffle trials of a given condition
> using numpy:
> > np.random.shuffle(ds[ds.targets==1])
>
> Shuffling can mean at least two things in this context:
>
> 1) randomly re-order the order of the samples and the associated sample
> attributes; this can be achieved by simple indexing. For example, if a
> dataset ds has 4 samples, then ds[[3,2,1,0]] would reverse the order of
> the samples and the associated sample attributes in .sa. Also, ds[[0,2]]
> would select the first and third sample.
> 2) randomly change condition labels (targets), for example to generate a
> null distribution. AttributePermutator in mvpa2.generators.permutation may
> be helpful for this.
>
> Which one applies to your question?
>
> For the second option: My personal preferred strategy would be to split
> the dataset by unique chunks, then randomly re-assign targets for each
> sub-dataset, and then stack these sub-datasets back into a big dataset.
> This seems better than the 'simple' strategy - at least in an fMRI context
> - because that can break independence assumptions.
> However I did not find this option available (using strategy='chunks' gave
> an error). Maybe I missed it - or if not, we may consider adding it.
>
>
>
>
> *************************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20170915/cf6cd51e/attachment.html>
More information about the Pkg-ExpPsy-PyMVPA
mailing list