Feature scoring

All feature scoring algorithms implements the following method. Higher scores are better.

  1. public double score(int attIndex);

This method will return the score for the supplied feature index.

Typical usage of a feature scoring algorithm is shown in the snippet below

  1. /* Load the iris data set */
  2. Dataset data = FileHandler.loadDataset(new File("iris.data"), 4, ",");
  3. /* Create a feature scoring algorithm */
  4. GainRatio ga = new GainRatio();
  5. /* Apply the algorithm to the data set */
  6. ga.build(data);
  7. /* Print out the score of each attribute */
  8. for (int i = 0; i < ga.noAttributes(); i++)
  9. System.out.println(ga.score(i));
[Documented source code]