[pymvpa] Altering the weights of classes in binary SVM classifier
Michael Browning
michael.browning at ndcn.ox.ac.uk
Thu Aug 13 08:30:53 UTC 2015
Hi,
Any advice on this would be really appreciated,
Thanks
Mike
From: Pkg-ExpPsy-PyMVPA [mailto:pkg-exppsy-pymvpa-bounces+michael.browning=ndcn.ox.ac.uk at lists.alioth.debian.org] On Behalf Of Michael Browning
Sent: 23 July 2015 13:57
To: pkg-exppsy-pymvpa at lists.alioth.debian.org
Subject: Re: [pymvpa] Altering the weights of classes in binary SVM classifier
Hi,
I have been using a linear SVM in a between subject design in which I am trying to classify patients as responders or non-responders to a particular treatment. The input to the classifier are beta images (one per patient) from an fMRI task. The target of the classifier is response status of the patient (coded as 0 or 1).
My sample is not balanced (there happens to have been 22 responders and 13 non-responders) and is not particularly large. I would like, if possible, to use all the data and adjust the classifier to the unbalanced set rather than selecting a subset of the responders. I've seen recommendations for SVMs in unbalanced data suggesting that the weights of the outcome can be adjusted to reflect the sample size (essentially the weights of each class can be set as 1/(total number in class)).
I've tried to do this in pyMVPA using the following code:
wts=[ 1/numnonresp, 1/numresp]
wts_labels=[0,1]
clf = LinearCSVMC(weight=wts, weight_label=wts_labels)
I then embed the classifier in a crossvalidation call which includes a feature selector.
The code runs without error but the performance of the classifier does not alter (at all) regardless of the weights I use (e.g. using weights of [0 100000000000] or whatever. I'm concerned that I have not set this up correctly, and that the weights are not being incorporated into the SVM.
I'd appreciate any advice about what I am doing wrong, or even if there is any diagnostic approach I can use to assess whether the SVM is using the weight appropriately.
Thanks
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20150813/076e8fd3/attachment-0001.html>
More information about the Pkg-ExpPsy-PyMVPA
mailing list