<div dir="ltr"><p class="MsoNormal"><span lang="EN-US">Hi, I’m
trying to evaluate on trial by trial basis how well a region can predict the
stimulus being presented to compare it with the participant’s judgment of the
stimulus. So I’m training the classifier with data from all the trials on all
the runs except by the one that I want to predict.</span></p>

<p class="MsoNormal"><span lang="EN-US"><br></span></p><p class="MsoNormal"><span lang="EN-US">I’m getting
really good classifications better than when I was predicting one run using all
the others. Supposedly it should be a little better as I’m training with a
little more data but I’m worried I’m doing something wrong.</span></p>

<p class="MsoNormal"><span lang="EN-US"><br></span></p><p class="MsoNormal"><span lang="EN-US">Could anyone
let me know if I’m making some sort of mistake?</span></p>

<p class="MsoNormal"><span lang="EN-US"><br></span></p><p class="MsoNormal"><span lang="EN-US">I know that
there should be a more efficient way to do it but I wanted something easy, this
is my code:</span></p><p class="MsoNormal"><span lang="EN-US"><br></span></p>

<p class="MsoNormal"><span lang="EN-US">predictions
= [] #this is a vector that will contain the predictions of the classifier</span></p>

<p class="MsoNormal"><span lang="EN-US">for
i,dsTest in enumerate(ds): #go through all the trials on ds and separate one to
test</span></p>

<p class="MsoNormal"><span lang="EN-US">    clf = LinearCSVMC() </span></p>

<p class="MsoNormal"><span lang="EN-US">    fclf = FeatureSelectionClassifier(clf,
fsel)</span></p>

<p class="MsoNormal"><span lang="EN-US">    dsTrain = [] </span></p>

<p class="MsoNormal"><span lang="EN-US">    dsTrain.append(ds[0:i]) #separates the
training data</span></p>

<p class="MsoNormal"><span lang="EN-US">    dsTrain.append(ds[i:-1])</span></p>

<p class="MsoNormal"><span lang="EN-US">    dsTrain = vstack(dsTrain) #stacks it</span></p>

<p class="MsoNormal"><span lang="EN-US">    fclf.train(dsTrain) </span></p>

<p class="MsoNormal"><span lang="EN-US">    predicted = fclf.predict(dsTest) #stores
the prediction</span></p>

<p class="MsoNormal"><span lang="EN-US">    predictions.append(dsTest.targets ==
predicted) #checks whether the prediction was correct</span></p>

<p class="MsoNormal"><span lang="EN-US">print
np.mean(predictions) #checks the mean -accuracy of all predictions</span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US">I would really
appreciate any feedback, thanks!</span></p></div>