<div dir="ltr">I have tried weighting unbalanced datasets using another language or package, but it's been so long ago that I unfortunately I can't find the code for it). <div><br></div><div>From what I recall, you would essentially inversely attribute weights to each of the class labels according to the label sample size. In other words, the class with the greater number of samples would be weighted proportionally less (I believe I weighted it relative to 1), and the class with fewer samples would be weighted proportionally more. From what I remember though, this method did no better than simply sub-sampling/oversampling the class with fewer samples. Obviously this may depend on other parameters as well (such as overall class sizes), however. (Altering weights also did quite poorly for extremely unbalanced datasets.)  </div><div><br></div><div>While sub-sampling the larger class may be unstable (as Jo mentioned), I've gotten decent results by bootstrapping (sampling with replacement) samples from both classes to n samples, where n is larger than the number of samples from the largest class (often times I've made n to be quite large for robust results). As long as your smallest class has enough samples, I think this method could prove to be useful. At the very least this method won't bias your classifier.</div><div><br></div><div>Alternatively, if you simply just want to maximize your training set to include all samples, you could run a permutation test as well. While this will bias your classifier and most likely inflate your accuracy rates, if you have a null distribution with enough iterations, you can still run significance testing.<br></div><div><br></div><div>Taku</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 22, 2015 at 3:20 PM, J.A. Etzel <span dir="ltr"><<a href="mailto:jetzel@wustl.edu" target="_blank">jetzel@wustl.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I wonder if the lack of responses is because people (myself included) don't use weighting for fMRI datasets, but rather balance through subsetting and experimental design ... anyone use (or ever tried) weighting unbalanced datasets?<br>
<br>
I've never tried analyzing a dataset as badly balanced (3 to 1) as your example; subsetting is certainly very unstable in this case. Perhaps you can reduce the imbalance by changing the cross-validation partitioning (eg leave 2 runs out instead of 1 or on the subjects)?<br>
<br>
Jo<div><div class="h5"><br>
<br>
<br>
On 4/22/2015 12:43 PM, Bill Broderick wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Hi all,<br>
<br>
I think my first question was broader than it needed to be, so hopefully<br>
this is more to the point.<br>
<br>
I'm trying to run MVPA on a classification with unbalanced classes,<br>
using a Linear SVM, and would like to weight the error signals to<br>
correct for unbalanced-ness. With PyMVPA's Linear CSVMC<br>
(<a href="http://www.pymvpa.org/generated/mvpa2.clfs.svm.LinearCSVMC.html" target="_blank">http://www.pymvpa.org/generated/mvpa2.clfs.svm.LinearCSVMC.html</a>), it<br>
looks like there's a weight and weight_label parameter that would do<br>
what I would like, but I cannot find any usage examples. Can someone<br>
provide me with one?<br>
<br>
For example, if I have a dataset with three times as many examples in<br>
class A as in class B, how would I set up the Linear CSVMC to weight the<br>
error in class B as three times larger?<br>
<br>
Thanks,<br>
William<br>
<br>
<br></div></div>
_______________________________________________<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>
</blockquote>
<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>
</blockquote></div><br><br>
</div></div>