Thanks Yaroslav! I tried the Balancer generator but it didn't help in the following case of binary classification on random samples:<br><br>from mvpa2.suite import *<br>clf=LinearCSVMC();<br>cv=CrossValidation(clf,ChainNode([NFoldPartitioner(),Balancer()],space='partitio<br>
ns'))<br>acc=[]<br>for i in range(200):<br> print i<br> ds=Dataset(np.random.rand(200))<br> <a href="http://ds.sa">ds.sa</a>['targets']=np.remainder(range(200),2)<br> <a href="http://ds.sa">ds.sa</a>['chunks']=range(200)<br>
 results=cv(ds)<br> acc.append(1-np.mean(results))<br><br>>>>print np.mean(acc),np.std(acc)<br>0.4106 0.212417960634<br><br>Or what's the proper way to set up Balancer()? This generator is not described in the PyMVPA manual 2.0.1.... :(<br>
<br>Thanks!<br>Dale<br><br>On Fri, Apr 20, 2012 at 12:34 PM, Yaroslav Halchenko <<a href="mailto:debian@onerussian.com" target="_blank">debian@onerussian.com</a>> wrote:<br>
if we were to talk about bias we would talk about classification of true<br>effects ;)<br><br>you are trying to learn/classify noise on disbalanced sets -- since you<br>have 'events' == range(200), each sample/event is taken out<br>

separately you have 100 of one target (say 1) and 99 of the other (say<br>0).  Since it is a pure noise, classifier might choose just say that it<br>is the target with majority samples (regardless of the actual data which<br>

is noise) since that would simply minimize its objective function during<br>training.  As a result you would get this "anti-learning" effect.  That<br>is why we usually suggest to assure to have equal number of samples per<br>

each category in training set (or chain with Balancer generator if data<br>is disbalanced).<br><br>On Fri, 20 Apr 2012, Ping-Hui Chiu wrote:<br><br>>    Dear PyMVPA experts,<br>>    Isn't a leave-one-out cross-validation supposed to produce a smaller bias<br>

>    yet a larger variance in comparison to N-fold cross-validations when N<#<br>>    of samples?<br><br>>    I ran a sanity check on binary classification of 200 random samples.<br>>    4-fold cross-validations produced unbiased estimates (~50% correct),<br>

>    whereas leave-one-out cross-validations consistently produced<br>>    below-than-chance classification performances (~40% correct). Why?<br><br>>    Any insight on this will be highly appreciated!<br><br>>    My code is listed below:<br>

<br>>    from mvpa2.suite import *<br>>    clf = LinearCSVMC();<br>>    cv_chunks = CrossValidation(clf, NFoldPartitioner(attr='chunks'))<br>>    cv_events = CrossValidation(clf, NFoldPartitioner(attr='events'))<br>

>    acc_chunks=[]<br>>    acc_events=[]<br>>    for i in range(200):<br>>    �print i<br>>    �ds=Dataset(np.random.rand(200))<br>>    �[1]<a href="http://ds.sa" target="_blank">ds.sa</a>['targets']=np.remainder(range(200),2)<br>

>    �[2]<a href="http://ds.sa" target="_blank">ds.sa</a>['events']=range(200)<br>>    �[3]<a href="http://ds.sa" target="_blank">ds.sa</a>['chunks']=np.concatenate((np.ones(50),np.ones(50)*2,np.ones(50)*3,np.ones(50)*4))<br>
>    �ds_chunks=cv_chunks(ds)<br>
>    �acc_chunks.append(1-np.mean(ds_chunks))<br>>    �ds_events=cv_events(ds)<br>>    �acc_events.append(1-np.mean(ds_events))<br><br>>    >>>print np.mean(acc_chunks), np.std(acc_chunks)<br>>    0.50025 0.0442542370853<br>

>    >>>print np.mean(acc_events), np.std(acc_events)<br>>    0.40674 0.189247516232<br><br>>    Thanks!<br>>    Dale<br><br>> References<br><br>>    Visible links<br>>    1. <a href="http://ds.sa/" target="_blank">http://ds.sa/</a><br>

>    2. <a href="http://ds.sa/" target="_blank">http://ds.sa/</a><br>>    3. <a href="http://ds.sa/" target="_blank">http://ds.sa/</a><br><br>> _______________________________________________<br>> Pkg-ExpPsy-PyMVPA mailing list<br>
> <a href="mailto:Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org" target="_blank">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>--<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" target="_blank">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>