I know that j48 decision tree uses gain ratio
to select attribute for making tree.
But i want to use information gain
and random selection
instead of gain ratio. In select attribute tab
in Weka Explorer, I choose InfoGainAttributeEval
and put start button. After that I see the sorted list of attribute with information gain method. But I don't know how to use this list to run j48 in Weka. Moreover I don't know how to select attribute randomly in j48.
Please help me if you can.
1 Answers
If you want to perform feature selection on the data before running the algorithm you have to options:
In the
Classify
tab useAttributeSelectedClassifier
(under themeta
folder). There you can configure the feature selection algorithm you want. (The default isJ48
withCfsSubsetEval
).In the
Preprocess
tab find and applyAttributeSelect
filter (located atsupervised\attribute
folder). The default here is also theCfsSubsetEval
algorithm.
Notice that the first method will apply the algorithm only on the train set when you'll evaluate the algorithm, while the second method will use the entire dataset and will remove features that were not selected (you can use undo to bring them back).
Notice that the way J48 selects features during the training process will remain the same. To change it you need to implement your own algorithm or change the current implementation.