No oddities. I just thought I would pass along some concrete usage which might expose a mistake that I was unaware of... nothing worse than a mistake that returns reasonable but incorrect results. <div><br></div><div>Thanks again<br>
<br><div class="gmail_quote">On Sun, Jan 8, 2012 at 7:03 PM, Yaroslav Halchenko <span dir="ltr"><<a href="mailto:debian@onerussian.com">debian@onerussian.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
On Sun, 08 Jan 2012, Tyson Aflalo wrote:<br>
</div><div class="im">> I happen to be using libsvm, so I am attempting to use option 2. From<br>
> what I understand SplitClassifier is a meta-classifier, and so I can<br>
> simply feed my previous classifier to SplitClassifier and feed that to<br>
> CrossValidation. SplitClassifier than just provides a layer that can save<br>
> stuff out over the folds... I have a tenuous grasp but hopefully this is<br>
> basically correct. <br>
<br>
</div> seems to be 100% identical to my comprehension of that beast ;)<br>
<div class="im"><br>
> Can you glance at the couple of lines below to verify<br>
> that I am using SplitClassifier correctly? <br>
<br>
</div>I think it looks all right -- have you spot some oddity which lead you<br>
to ask this question?<br>
<div class="im"><br>
> Thanks for the help!<br>
<br>
> baseclf = LinearCSVMC()<br>
<br>
> svdmapper=SVDMapper()<br>
<br>
> get_SVD_sliced = lambda x: ChainMapper([svdmapper,<br>
> StaticFeatureSelection(x)])<br>
<br>
> metaclf = MappedClassifier(baseclf, get_SVD_sliced(slice(0, 15)))<br>
<br>
> sc = SplitClassifier(metaclf, enable_ca=['stats'])<br>
<br>
> cv = CrossValidation(sc, NFoldPartitioner(),<br>
> errorfx=mean_mismatch_error, enable_ca=['stats','datasets'])<br>
<br>
> err = cv(ds)<br>
<br>
> # now to test the novel dataset on an example classifier<br>
<br>
> mean(sc.clfs[1].predict(ds2.samples) == ds2.targets)<br>
<br>
> On Sun, Jan 8, 2012 at 4:14 PM, Yaroslav Halchenko<br>
</div><div><div class="h5">> <[1]<a href="mailto:debian@onerussian.com">debian@onerussian.com</a>> wrote:<br>
<br>
> there are 2 ways:<br>
<br>
> 1. [available only in mvpa2]<br>
> any RepeatedMeasure (including CrossValidation) takes argument<br>
> 'callback':<br>
<br>
> callback : functor<br>
> Optional callback to extract information from inside the main<br>
> loop of<br>
> the measure. The callback is called with the input 'data', the<br>
> 'node'<br>
> instance that is evaluated repeatedly and the 'result' of a<br>
> single<br>
> evaluation -- passed as named arguments (see labels in quotes)<br>
> for<br>
> every iteration, directly after evaluating the node.<br>
<br>
> so there you could access anything you care about in the 'node', which<br>
> is<br>
> classifier in this case<br>
<br>
> BUT because the same classifier instance gets reused through the<br>
> iterations,<br>
> you can't just "store" the classifier. you can deepcopy some of them<br>
> (e.g.<br>
> the ones relying on swig-ed APIs, like libsvm, would not be<br>
> deepcopy-able)<br>
<br>
> 2. SplitClassifier<br>
<br>
> That one behaves similarly to cross-validation (just access its<br>
> .ca.stats to<br>
> get results of cross-validation), but also operates on copies of the<br>
> originally<br>
> provided classifier, so you could access all of them via .clfs<br>
> attribute.<br>
<br>
> Helps?<br>
> On Sun, 08 Jan 2012, Tyson Aflalo wrote:<br>
<br>
> > Is there a means of accessing each trained classifier that is<br>
> generated as<br>
> > part of a cross-validation analysis?�<br>
<br>
> > Thanks,<br>
<br>
> > tyson<br>
<br>
> > _______________________________________________<br>
> > Pkg-ExpPsy-PyMVPA mailing list<br>
</div></div>> > [2]<a href="mailto:Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org">Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org</a><br>
<br>
> [3]<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>
<div class="HOEnZb"><div class="h5">--<br>
=------------------------------------------------------------------=<br>
Keep in touch <a href="http://www.onerussian.com" target="_blank">www.onerussian.com</a><br>
Yaroslav Halchenko <a href="http://www.ohloh.net/accounts/yarikoptic" target="_blank">www.ohloh.net/accounts/yarikoptic</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></div></div></blockquote></div><br></div>