How do You Create a Decision Tree using Weka?

Click the Open File button -> select the data file called lady gaga. of. Weka parses the data model and pre-processes the data. Within no time you’re already getting information based on the pre-processing of the data model and the data.

The Select Attribute pane is on the right side of the Explorer window. It shows that the three distinct nominal values of the customer_purchase attribute. Weka has also noticed that you have 14 instance rows and the five attributes.

After pre-processing comes a classification. Click the Classify button in the top row of buttons. You’re going to use the C4.5 classification algorithm; within Weka, this is called the J48 algorithm. In the Classifier pane -> click the Choose the button -> select the J48 option under the Trees menu heading. The selection pane closes automatically, and you see that the name of the classifier has changed from the default ZeroR to J48 –C 0.25 –M

The option flags used in the default J48 classifier are setting the pruning confidence (the –C flag) and the minimum number of instances (-M). To run the classifier -> click the Start button -> watch the Classifier output
window. You see the information on the run appear. The run information tells you about the scheme used and gives a run-down on the model on which Weka has worked. Interesting data starts to emerge. The J48 pruned tree gives results on, in this case, the placement, as it has the highest information gain: