[pymvpa] How does OddEvenSplitter work when there are 5 chunks?

Yaroslav Halchenko debian at onerussian.com
Mon Dec 29 03:29:57 UTC 2008


>    I have 5 chunks (runs) for my data and wonder how I can do the 5-fold
>    cross validation with the OddEvenSplitter module.
For X-fold cross validation use, NFoldSplitter.

OddEvenSplitter would give you just 2 splits, in one odd chunks are
used for training, in the other one even ones are used for training

>    Also, I don't even know how to view the script of OddEvenSplitter to
>    figure out what it does as i'm a total newbie for the python
>    prgramming.
not clear what you want to view here... 
you just need to use splitter (any splitter like OddEvenSplitter,
NFoldSplitter) whenever it is needed (e.g. CrossValidatedTransferError,
SplitClassifier)

if you want to see what samples get selected by a splitter, then look at
origids after applying splitter... smth like

In [76]:splits = list(OddEvenSplitter()(nds1))
In [77]:splits
Out[77]:
[[<Dataset / int16 120 x 1 uniq: 120 chunks 1 labels>,
  <Dataset / int16 120 x 1 uniq: 120 chunks 1 labels>],
 [<Dataset / int16 120 x 1 uniq: 120 chunks 1 labels>,
  <Dataset / int16 120 x 1 uniq: 120 chunks 1 labels>]]
In [79]:splits[0][0].origids
Out[79]:
array([  0,   2,   4,   6,   8,  10,  12,  14,  16,  18,  20,  22,  24,
        26,  28,  30,  32,  34,  36,  38,  40,  42,  44,  46,  48,  50,
        52,  54,  56,  58,  60,  62,  64,  66,  68,  70,  72,  74,  76,
        78,  80,  82,  84,  86,  88,  90,  92,  94,  96,  98, 100, 102,
       104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128,
       130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154,
       156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180,
       182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206,
       208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232,
       234, 236, 238])

I hope this helps

-- 
Yaroslav Halchenko
Research Assistant, Psychology Department, Rutgers-Newark
Student  Ph.D. @ CS Dept. NJIT
Office: (973) 353-1412 | FWD: 82823 | Fax: (973) 353-1171
        101 Warren Str, Smith Hall, Rm 4-105, Newark NJ 07102
WWW:     http://www.linkedin.com/in/yarik        



More information about the Pkg-ExpPsy-PyMVPA mailing list