<div dir="ltr"><div><div><div>Hi Chris,<br><br></div>Thanks for getting back to me so fast. When i try to run that I get this error: <br><br>Traceback (most recent call last):<br> File "<stdin>", line 1, in <module><br>
KeyError: 1.0<br><br></div>I also changed the code a little because I saw the differences in preprocessing for wanting to run an nfoldpartitioner. I think it could have to do with what you think though because when i run either LinearNuSVMC or SMLR it gives me way too many samples back of accuracies. Here's the slightly changed code:<br>
<br>from mvpa2.suite import *<br>import numpy as np<br>import scipy.stats as sp<br>import <a href="http://scipy.io">scipy.io</a><br>import nibabel<br>import random<br>path = '/home/menglab/JG/AP/concat/Session 1'<br>
attr = SampleAttributes(os.path.join(path, 'attributes.txt'))<br><br>fds = fmri_dataset(samples=os.path.join(path, 'ap_all.nii'), targets = attr.targets, chunks=attr.chunks, mask = os.path.join(path, 'rFFA_AP1.nii'))<br>
<br>poly_detrend(fds, polyord=1, chunks_attr='chunks')<br>fds = fds[fds.sa.targets != 'none']<br><br>rnames = {'A': 'Face', 'B': 'High_Face', 'C': 'Low_Face', 'D': 'Non_Face'}<br>
<a href="http://fds.sa">fds.sa</a>['runtype'] = [rnames[chunks] for chunks in fds.sa.chunks]<br></div><div>#error happens here<br><br></div><div>clf = LinearCSVMC()<br>cvte = CrossValidation(clf, NFoldPartitioner(), errorfx=lambda p, t: np.mean(p == t))<br>
cv_results = cvte(fds)<br><br></div>Thanks!<br>Jessica<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jan 4, 2014 at 2:23 PM, Chris Johnson <span dir="ltr"><<a href="mailto:effigies@gmail.com" target="_blank">effigies@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This line is setting <a href="http://fds.sa" target="_blank">fds.sa</a>['runtype'] to a list with a single boolean<br>
(probably [False]).<br>
<br>
> <a href="http://fds.sa" target="_blank">fds.sa</a>['runtype'] = [rnames in fds.sa.chunks]<br>
<br>
I would guess what you want is:<br>
<br>
> <a href="http://fds.sa" target="_blank">fds.sa</a>['runtype'] = [rnames[chunk] for chunk in fds.sa.chunks]<br>
<br>
Hopefully that's all the problem is. Otherwise the code looks like it<br>
should run.<br>
<br>
Chris<br>
<div><div class="h5"><br>
<br>
On Sat, Jan 4, 2014 at 2:13 PM, Jessica Goold <<a href="mailto:jessi.goold@gmail.com">jessi.goold@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> I'm trying to run my first classification analysis on my own data, and every<br>
> classification type seems to work except LinearCSVMC(). I'm attaching my<br>
> python file of code and I've pasted the error I get at the bottom of it. Any<br>
> help on why this is happening would be great!<br>
><br>
> Thank you,<br>
> Jessica<br>
><br>
</div></div>> _______________________________________________<br>
> Pkg-ExpPsy-PyMVPA mailing list<br>
> <a href="mailto:Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org">Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org</a><br>
> <a href="http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa" target="_blank">http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa</a><br>
<br>
_______________________________________________<br>
Pkg-ExpPsy-PyMVPA mailing list<br>
<a href="mailto:Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org">Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa" target="_blank">http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa</a><br>
</blockquote></div><br></div>