<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><span id="ms-rterangepaste-start"></span></p>
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am running an EEG experiment which involves presenting one of two images on the screen and recording the participant's neural activation. Right now I'm writing a script to take these recordings and attempt to decode from the EEG data
 which image has been displayed. I have had success on similar scripts making use of PyMVPA's PLR, however in these cases the classes are balanced whereas in the experiment I'm trying to do now the ratio is closer to 1:4. The initial approach I had in mind
 was to use asymmetrical error weights to penalize misclassification of the less numerous class more than the dominant class. I understand that there are various other approaches to handling unbalanced classes, such as over/undersampling or using a classifier
 more robust in this regard such as random forests, but this seemed to me to be the most clean way to start.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I tried the class weight parameter in SKLearn as per this tutorial http://scikit-learn.org/stable/auto_examples/svm/plot_separating_hyperplane_unbalanced.html, and this seemed to work well for the data here, but failed to make any difference
 when I used my EEG data. Upon increasing the number of dimensions in the sample data (changing the 2 in n_samples_1, 2), I noticed the difference between the predictions of the classifier with weights and the classifier without weights diminish. By the time
 I had reached 7 features per training sample the predictions were the same. Does this parameter just not work well with many dimensions? My EEG data has around 200 trials (samples) and each sample has 180 datapoints in each of 20 electrode channels, so my
 training data is shaped 200 * 3600. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I thought the weight parameter here was exactly what I was looking for http://www.pymvpa.org/generated/mvpa2.clfs.svm.LinearCSVMC.html#mvpa2.clfs.svm.LinearCSVMC, however when I tried to use it even with toy data I saw no difference, similar
 to the issue in https://www.mail-archive.com/pkg-exppsy-pymvpa@lists.alioth.debian.org/msg02918.html. Some excerpts from my script follow, am I just overlooking something?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Ben<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">wclf = LinearCSVMC(weight=[2,8], weight_label=[True, False])<o:p></o:p></p>
<p class="MsoNormal">wanovaSelectedClassifier = M.FeatureSelectionClassifier(<o:p></o:p></p>
<p class="MsoNormal">            wclf,<o:p></o:p></p>
<p class="MsoNormal">            M.SensitivityBasedFeatureSelection(<o:p></o:p></p>
<p class="MsoNormal">                        M.OneWayAnova(),<o:p></o:p></p>
<p class="MsoNormal">                        M.FixedNElementTailSelector(numFeatures, mode='select', tail='upper')<o:p></o:p></p>
<p class="MsoNormal">            )<o:p></o:p></p>
<p class="MsoNormal">)<o:p></o:p></p>
<p class="MsoNormal">wfoldwiseCvedAnovaSelectedSVM = M.CrossValidation(<o:p></o:p></p>
<p class="MsoNormal">            wanovaSelectedClassifier,<o:p></o:p></p>
<p class="MsoNormal">            M.NFoldPartitioner(),<o:p></o:p></p>
<p class="MsoNormal">            enable_ca=['samples_error','stats', 'calling_time','confusion']<o:p></o:p></p>
<p class="MsoNormal">)<o:p></o:p></p>
<p class="MsoNormal">dataset = M.dataset_wizard(samples=X, targets=y, chunks=np.mod(np.arange(0,len(X)),numFolds))<o:p></o:p></p>
<p class="MsoNormal">wresults = wfoldwiseCvedAnovaSelectedSVM(dataset)<o:p></o:p></p>
<p class="MsoNormal">print wfoldwiseCvedAnovaSelectedSVM.ca.stats.as_string()<o:p></o:p></p>
<!--EndFragment--><span id="ms-rterangepaste-end"></span><br>
<p></p>
</div>
</body>
</html>