Feature ranking

All feature ranking algorithms provide the following method to determine the rank of a features. Lower ranks are better.

  1. public int rank(int attIndex);

The method will return the rank of the feature with the provided index.
Typical usage of a feature ranking algorithm is very similar to the use of the feature scoring algorithms.
  1. /* Load the iris data set */
  2. Dataset data = FileHandler.loadDataset(new File("iris.data"), 4, ",");
  3. /* Create a feature ranking algorithm */
  4. RecursiveFeatureEliminationSVM svmrfe = new RecursiveFeatureEliminationSVM(0.2);
  5. /* Apply the algorithm to the data set */
  6. svmrfe.build(data);
  7. /* Print out the rank of each attribute */
  8. for (int i = 0; i < svmrfe.noAttributes(); i++)
  9. System.out.println(svmrfe.rank(i));
[Documented source code]