[pymvpa] zscore / ZScoreMapper: How to transform both datasets of a split equally

Thorsten Kranz thorstenkranz at googlemail.com
Fri Feb 25 09:13:53 UTC 2011


Hi all,

I think this should be trivial, but maybe I'm not seeing the forest
for the trees.

I want to do a cross-validation, I do this manually, also involving a
custom mapper, by (simplified Example):

cm = ConfusionMatrix()
clfr = SVM()
for d1, d2 in NFoldSplitter(nperlabel="equal")(dataset):
    mcm = MyCustomMapper(...)
    mcm.train(d1)
    d1_mapped = mcm.forward(d1)
    d2_mapped = mcm.forward(d2)
    # Here the two mapped datasets should be zscored equally, but with
perchunk=False, pervoxel=True
    ???
    clfr.train(d1_mapped)
    cm.add(clfr.predict(d2_mapped.samples),d2_mapped.labels)

I don't see how to zscore both mapped datasets equally AND
pervoxel=True, perchunk=False. I would love to use the ZScoreMapper
for that, but it doesn'T provide the "per*" arguments. And the method
zscore does accept parameters mean and std, but doesn't return them
when called so I could reuse them in a second call.

I guess I will write my own zscore-method, just copy-pasting it from
your source, but returning mean and std.

Or do you have another / better proposal?

Greetings,
Thorsten



More information about the Pkg-ExpPsy-PyMVPA mailing list