<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div><span style="FONT-FAMILY: Times New Roman; FONT-SIZE: 18px"><b>Hi all,</b></span></div>
<div><span style="FONT-FAMILY: Times New Roman; FONT-SIZE: 18px"><b>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. </b></span></div>
<div><span style="FONT-FAMILY: Times New Roman"></span> </div>
<div><span style="FONT-FAMILY: Times New Roman"><b>My scripts:</b></span></div>
<div><span style="FONT-FAMILY: Times New Roman">from mvpa2.suite import *<br>from mvpa2.mappers.detrend import poly_detrend<br>from mvpa2.datasets.mri import fmri_dataset</span></div>
<div><span style="FONT-FAMILY: Times New Roman">import numpy as np</span></div>
<div><span style="FONT-FAMILY: Times New Roman">clf = LinearCSVMC()</span></div>
<div><span style="FONT-FAMILY: Times New Roman">ds = fmri_dataset(samples=FMRIFile, targets=attrs.targets, chunks=attrs.chunks, mask = maskFile)<br>poly_detrend(ds, polyord=1, chunks_attr='chunks')<br>zscore(ds, chunks_attr='chunks')</span></div>
<div><span style="FONT-FAMILY: Times New Roman">partitioner = NFoldPartitioner()<br>repeater = Repeater(count=10000)<br>permutator = AttributePermutator('targets', limit={'partitions': 1}, count=1)</span></div>
<div><span style="FONT-FAMILY: Times New Roman">null_cv = CrossValidation(<br> clf, <br> ChainNode(<br> [partitioner, permutator],<br> space=partitioner.get_space()),<br> postproc=mean_sample(),<br> <b>errorfx=lambda p,t: np.mean(p == t))</b><br>distr_est = MCNullDist(repeater, tail='left', measure=null_cv, enable_ca=['dist_samples'])<br>cv_mc_corr = CrossValidation(clf,<br> partitioner,<br> postproc=mean_sample(),<br> null_dist=distr_est,<br> enable_ca=['stats'],<br> <b> errorfx=lambda p,t: np.mean(p == t))</b><br>result = cv_mc_corr(ds)<br>p = cv_mc_corr.ca.null_prob<br>distribution = cv_mc_corr.null_dist.ca.dist_samples</span></div>
<div><span style="FONT-FAMILY: Times New Roman"></span> </div>
<div><span style="FONT-FAMILY: Times New Roman"><b>my question:</b></span></div>
<div><span style="FONT-FAMILY: Times New Roman"><strong>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?</strong></span></div>
<div><span style="FONT-FAMILY: Times New Roman"><strong></strong></span> </div>
<div><span style="FONT-FAMILY: Times New Roman"><strong></strong></span><span style="FONT-FAMILY: Times New Roman"><strong> </strong></span></div>
<div><br></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>