This is what I want to achieve. I made my own function for now.<br><br>def crossValidate(clf, ds, nReps=10, trainRatio=0.8):<br>    # number of samples per target, get the min<br>    N = min(ds.get_nsamples_per_attr(&#39;targets&#39;).values())<br>

<br>    # number of training samples<br>    nTrain = int(N*trainRatio)<br><br>    # a confusion matrix to store the result<br>    cm = ConfusionMatrix()<br><br>    for n in range(nReps):<br>        # selected samples for training and testing<br>

        dTrain, dTest = [], []<br>        for t in <a href="http://ds.sa">ds.sa</a>[&#39;targets&#39;].unique:<br>            idx = np.random.permutation(ds.get_samples_by_attr(&#39;targets&#39;,t))<br>            dTrain.extend( idx[:nTrain] )<br>

            dTest.extend( idx[nTrain:N] )<br><br>        if clf.trained: clf.untrain()<br>        clf.train(ds[dTrain])<br>        cm.add(ds[dTest].targets,clf.predict(ds[dTest].samples))<br><br>    return cm<br><br><br>
Is there a way to achieve this with CrossValidation? I haven&#39;t checked the method you proposed yet:<br>
CrossValidation(clf,<br>                       
Balancer(amount=0.8, limit=None, attr=&#39;targets&#39;, count=3),<br>
                        splitter=Splitter(&#39;balanced_set&#39;, [True, False]))<br><br><br>Regards<br>Brice<br><br><div class="gmail_quote">On Fri, Apr 8, 2011 at 11:05 AM, Yaroslav Halchenko <span dir="ltr">&lt;<a href="mailto:debian@onerussian.com">debian@onerussian.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">eh -- sorry, splitter as an argument came in not even a month ago,<br>
already after rc2.<br>
you would need either to wait for rc3 (can be furnished early next week)<br>
or just build/use pymvpa from sources -- it is quite easy actually<br>
<div class="im"><br>
On Fri, 08 Apr 2011, brice rebsamen wrote:<br>
<br>
&gt;    Thanks,<br>
&gt;    CrossValidation(clf,<br>
&gt;                   Balancer(amount=0.8, limit=None, attr=&#39;targets&#39;,<br>
&gt;    count=3),<br>
&gt;                   splitter=Splitter(&#39;balanced_set&#39;, [True, False]))<br>
&gt;    This seems like a good idea, but I get this error message:<br>
&gt;    TypeError: Unexpected keyword argument splitter=&lt;Splitter&gt; for<br>
&gt;    &lt;CrossValidation&gt;. Valid parameters are [&#39;datasets&#39;, &#39;training_stats&#39;,<br>
&gt;    &#39;raw_results&#39;, &#39;calling_time&#39;, &#39;training_time&#39;, &#39;null_t&#39;, &#39;null_prob&#39;,<br>
&gt;    &#39;stats&#39;, &#39;repetition_results&#39;]<br>
&gt;    I think I understand the role of the &#39;chunks&#39; attribute, and I see how<br>
&gt;    I should use it. I guess my samples are not all independent...<br>
&gt;    Regards<br>
&gt;    Brice<br>
</div>--<br>
<div><div></div><div class="h5">=------------------------------------------------------------------=<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/mailman/listinfo/pkg-exppsy-pymvpa" target="_blank">http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa</a><br>
</div></div></blockquote></div><br>