1
votes

When I use the Weka Explorer to Select Attributes with InfoGainAttribute evaluator, I get all featured ranked in the Attribute selection output panel

Weka Explorer

But I need now to do the same operation with the command line. The problem is that I don'nt know how to get the Attribute selection output with the command line

This is my command line:

java -classpath weka.jar weka.filters.supervised.attribute.AttributeSelection -E weka.attributeSelection.InfoGainAttributeEval -S "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" -i input.arff -o output.arff

The result of this operation is the output.arff file, with the same content that input.arff file.

I need the Ranked Attributes.

1

1 Answers

1
votes

When you look into the Explorer's log (click on button in bottom right corner), you will see something like this in the output:

12:13:46: Started weka.attributeSelection.InfoGainAttributeEval
12:13:46: Command: weka.attributeSelection.InfoGainAttributeEval -s "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1"
12:13:46: Filter command: weka.filters.supervised.attribute.AttributeSelection -E "weka.attributeSelection.InfoGainAttributeEval " -S "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1"
12:13:46: Meta-classifier command: weka.classifiers.meta.AttributeSelectedClassifier -E "weka.attributeSelection.InfoGainAttributeEval " -S "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" -W weka.classifiers.trees.J48 -- -C 0.25 -M 2
12:13:46: Finished weka.attributeSelection.InfoGainAttributeEval weka.attributeSelection.Ranker

If you want to get the output from the Explorer, you use Command, if you want to filter your data, you use Filter command and when you want to train a classifier, you use Meta-classifier command.

In your case, the command therefore would something like this (no output file!):

java -classpath weka.jar weka.attributeSelection.InfoGainAttributeEval -s "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" -i input.arff

That you received the same data in output.arff as you used as input via input.arff is expected, as the Ranker only ranks the attributes, but doesn't actually modify the data itself.

Rule of thumb: SubsetEval schemes will modify the dataset, AttributeEval schemes can be used for ranking.