<div dir="ltr">Hey,<div><br></div><div>On Wed, Mar 19, 2014 at 10:44 PM, Wouter De Baene <span dir="ltr"><<a href="mailto:Wouter.DeBaene@ugent.be" target="_blank">Wouter.DeBaene@ugent.be</a>></span> wrote:<br></div><div class="gmail_extra">

<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi all,<br>
<br>
I’m running my first pymvpa-analysis after attending a very nice pymvpa workshop in Delmenhorst.<br></blockquote><div><br></div><div>Glad you liked it!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


Although there are a few related questions in the archive, I don’t seem to get this working.<br>
I’m setting up a searchlight analysis with Nfold cross-validation. I'm trying to look at the confusion matrix for each cross-validation for each searchlight. This information seems to be lost when using searchlights.<br>


As I understood there were some plans to aggregate the output per searchlight into the output of the total results. Is there any news about this? OR could I get to this information in another way for now?<br></blockquote>

<div><br></div><div>The easiest way to aggregate this kind of non-scalar information within a searchlight is to</div><div>get the confusion matrix to come out of the CrossValidation as a vector (flattened matrix).</div><div>

For the first part of a possible solution we have "Confusion", a node that turns raw targets</div><div>predictions into a confusion table. Here is a sketch: no error computing in the classifier, return</div><div>
raw predictions, use Confusion as a post-processing node to yield matrices.</div><div><br></div><div><div>     CrossValidation(some_classifier,</div><div>                      some_partitioner,</div><div>                      errorfx=None,</div>
<div>                      postproc=Confusion())</div></div><div><br></div><div>Now the last bit is to flatten the confusion matrix into a vector. You could write a simple Node</div><div>implementation that does that. Here is some pseudo code:</div>
<div><br></div><div>class MyFlatMatrix(Node):</div><div>  def _call(ds):</div><div>    return Dataset(ds.samples.ravel())</div><div><br></div><div>and now use this class as a post-processing node for Confusion itself.</div>
<div><br></div><div><div>    CrossValidation(some_classifier,</div><div>                      some_partitioner,</div><div>                      errorfx=None,</div><div>                      postproc=Confusion(postproc=MyFlatMatrix()))</div>
</div><div><br></div><div>stick this into a searchlight and it should harvest what you want. This is all written as a sketch and wasn't tested...</div><div><br></div><div>Instead of a custom Node class you could also use a ChainMapper comprised of a FlattenMapper and a TransposeMapper</div>
<div>to achieve the same thing....</div><div><br></div><div>Good luck!</div><div><br></div><div>Michael</div><div><br></div></div><div><br></div>-- <br><div dir="ltr">
<div>Michael Hanke</div><div><a href="http://mih.voxindeserto.de" target="_blank">http://mih.voxindeserto.de</a></div><div><div><br></div></div></div>
</div></div>