Package PyML :: Package feature_selection :: Module featsel :: Class RFE
[frames] | no frames]

Class RFE

source code

     object --+    
              |    
FeatureSelector --+
                  |
                 RFE

RFE (Recursive Feature Elimination) uses the vector w of an SVM for feature selection.

The method alternates between training a linear SVM and removing the features with the smallest value of the weight vector.

You can either choose the number of features or let RFE choose the number of features automatically; this is chosen as the minimal number of features such that the number of support vectors is within one standard deviation from the minimum number of support vectors.

Reference:

I. Guyon and J. Weston and S. Barnhill and V. Vapnik Gene selection for cancer classification using support vector machines. Machine Learning 46:389-422, 2002.
Instance Methods
 
initialize(self, data) source code
 
__init__(self, arg=None, **settings)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__repr__(self)
repr(x)
source code
 
__iter__(self) source code
 
getFeatures(self, w, numFeatures) source code
 
next(self) source code
 
run(self, data, *options, **args) source code
 
selectFeatures(self, data, *options, **args)
Returns: a list of predictive features
source code
 
rank(self, data, *options, **args)
Returns: a ranking of the features in the dataset by converting the scores to ranks
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

    Inherited from FeatureSelector
 
score(self, data, **args)
Returns: a score for each feature in the input dataset
source code
 
select(self, data, *options, **args)
invokes selectFeatures to find predictive features and eliminates the rest of the features from the input dataset
source code
 
test(self, data, *options, **args) source code
 
train(self, data, *options, **args)
invokes selectFeatures to find predictive features and eliminates the rest of the features from the input dataset
source code
Class Variables
    Inherited from FeatureSelector
  type = 'featureSelector'
Properties

Inherited from object: __class__

Method Details

__init__(self, arg=None, **settings)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • targetNum - perform backward elimination until this many features are left
  • mode - values - 'byFraction' or 'byNum' (default = 'byFraction')
  • numToEliminate - specifies the number of features to eliminate at each iteration in the byNum mode
  • fractionToEliminate - the fraction of features to eliminate at each iteration in the byFraction mode (default = 0.05)
  • autoSelect - [False] - whether the number of features should be chosen automatically
  • useScore - whether to modulate the vector w by the golub coefficient as in RSVM
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

selectFeatures(self, data, *options, **args)

source code 
Returns:
a list of predictive features
Overrides: FeatureSelector.selectFeatures
(inherited documentation)

rank(self, data, *options, **args)

source code 
Returns:
a ranking of the features in the dataset by converting the scores to ranks
Overrides: FeatureSelector.rank
(inherited documentation)