[pymvpa] prediction accuracy

Dai Xijian dairenyihao at 126.com
Mon Sep 15 01:10:24 UTC 2014


Hi all,
I want to conduct a MVPA analysis to classify two conditions of a task. To get the prediction accuracy and its p-value, I also want to configure a null-distribution using permutation testing. Below is my scripts and questions. 
 
My scripts:
from mvpa2.suite import *
from mvpa2.mappers.detrend import poly_detrend
from mvpa2.datasets.mri import fmri_dataset
import numpy as np
clf = LinearCSVMC()
ds = fmri_dataset(samples=FMRIFile, targets=attrs.targets, chunks=attrs.chunks, mask = maskFile)
poly_detrend(ds, polyord=1, chunks_attr='chunks')
zscore(ds, chunks_attr='chunks')
partitioner = NFoldPartitioner()
repeater = Repeater(count=10000)
permutator = AttributePermutator('targets', limit={'partitions': 1}, count=1)
null_cv = CrossValidation(
       clf, 
       ChainNode(
               [partitioner, permutator],
               space=partitioner.get_space()),
               postproc=mean_sample(),
               errorfx=lambda p,t: np.mean(p == t))
distr_est = MCNullDist(repeater, tail='left', measure=null_cv, enable_ca=['dist_samples'])
cv_mc_corr = CrossValidation(clf,
        partitioner,
        postproc=mean_sample(),
        null_dist=distr_est,
        enable_ca=['stats'],
        errorfx=lambda p,t: np.mean(p == t))
result = cv_mc_corr(ds)
p = cv_mc_corr.ca.null_prob
distribution = cv_mc_corr.null_dist.ca.dist_samples
 
my question:
I have get the prediction accuracy by use of this scripts. However, the prediction accuracy I got were approached chance level(0.5). What's wrong? Are my scripts correct?   I have used the script "errorfx=lambda p,t: np.mean(p == t)" two times, is it reasonable?
 
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20140915/217cdd26/attachment.html>


More information about the Pkg-ExpPsy-PyMVPA mailing list