Orange Forum • View topic - Recursive feature elimination with SVM

Recursive feature elimination with SVM

Report bugs (or imagined bugs).
(Archived/read-only, please use our ticketing system for reporting bugs and their discussion.)
Forum rules
Archived/read-only, please use our ticketing system for reporting bugs and their discussion.

Recursive feature elimination with SVM

Postby Sachiel » Wed May 12, 2010 22:15

Digging on the source code, I found the RFE class inside the orngSVM module. It looked perfect for what I was trying to achieve: feature selection based on SVM performance.

Event though it is not documented anywhere on the web, the docstrings and the code was clear enough to understand how it works. So, I tried:

rfe = orngSVM.RFE()
datafss = rfe(data, 10)

Which crashed because of:

Code: Select all
  File "/usr/lib/python2.6/dist-packages/orange/", line 338, in getAttrScores
    attrs = data.domain.attributese
AttributeError: 'orange.Domain' has no attribute 'attributese'

Ok, just a typo. I changed it to "attrs = data.domain.attributes" and run it again. But it crashes again:

Code: Select all
File "/home/sergi/Dropbox/doctorat/alfacs/codi/", line 154, in svm_fss_scoring
    datafss = rfe(data, 10) # returns an example table with only 10 best attributes
  File "/usr/lib/python2.6/dist-packages/orange/", line 361, in __call__
    scores = self.getAttrScores(data)
  File "/usr/lib/python2.6/dist-packages/orange/", line 341, in getAttrScores
    weights = getLinearSVMWeights(self.learner(data))
  File "/usr/lib/python2.6/dist-packages/orange/", line 246, in getLinearSVMWeights
    updateWeights(w, attr, float(SVs[svInd][attr]), classifier.coef[coefInd][svInd])
TypeError: value of 'N_Alexandrium spp.' is unknown and cannot be cast to a float

So, now I have a few questions:

- Is orngSVM.RFE "stable", or under development? I ask that because of the typo and the fact that it is not documented anywhere.

- Is this error caused by the missings I have on my data? I can run a SVM classifier on it with no problem, so I don't completely understand why it crashes with RFE.

Postby Ales » Thu May 13, 2010 11:07

I have commited the fix for handling the unknown values (and fixed the typo). Can you update from svn and try again.

RFE was written over two years ago and at the time only used on data without unknown values (the typo was introduced later by accident).

Return to Bugs