You are on page 1of 5

EXPERIMENT - 9

You can make your Decision Trees simpler by pruning the nodes. One approach is to use Reduced Error
Pruning - Explain this idea briefly. Try reduced error pruning for training your Decision Trees using cross-
validation (you can do this in Weka) and report the Decision Tree you obtain? Also, report your accuracy
using the pruned model. Does your accuracy increase?

AIM :

To Understand the process of Reduced Error Pruning, which involves selectively removing
branches or nodes from Decision Trees that contribute minimally to reducing overall error without
significantly affecting model accuracy.

Description :

A Reduced Error Pruning (REP) tree is a decision tree that has undergone a pruning process aimed at
simplifying its structure while maintaining or improving predictive accuracy. The pruning is performed
using the Reduced Error Pruning algorithm, which selectively removes branches or nodes from the
decision tree that contribute minimally to reducing overall error without significantly affecting model
accuracy.

Characteristics of an REP tree include:

1. Simplicity:

- The REP tree is typically simpler in structure compared to the original, unpruned decision tree. It
achieves this simplicity by removing unnecessary branches or nodes that do not significantly contribute
to improving model accuracy.

2. Interpretability:

- Due to its simplified structure, an REP tree is often more interpretable and easier to understand for
humans. The pruning process results in clearer decision rules that can be expressed as "if-then-else"
statements.

3. Generalization:

- Despite its simplified structure, an REP tree aims to maintain or even improve model accuracy on
unseen data. By removing noisy or irrelevant branches, the REP tree can generalize better to new
instances.

4. Pruning Criteria:

- The pruning process in an REP tree is guided by criteria that assess the impact of removing branches
on reducing error rates. Branches that contribute minimally to reducing overall error or that result in
only a slight increase in error are pruned.

5. Trade-offs:
- The creation of an REP tree involves trade-offs between model complexity and predictive accuracy. By
sacrificing some complexity, the REP tree aims to achieve a more interpretable model without
compromising accuracy significantly.

Procedure:

1. Load the dataset file into the software environment.

2. Select all attributes from the dataset to ensure that the decision tree model considers the full range of
available features during training.

3. Navigate to the classification tab and click on the "Classify" button to initiate the classification process.

4. Click on the "Choose" button to select the algorithm for building the decision tree model.

5. From the list of available algorithms, select "REP" (Reduced Error Pruning) to apply REP during the
training process.

6. Configure the cross-validation setup by specifying the number of folds. In this experiment, set the
number of folds to 2.

7. Initiate the cross-validation process by clicking on the "Start" button.

8.Monitor the training and pruning process of the decision tree model
=== Stratified cross-validation ===

=== Summary ===

Correctly Classified Instances 731 73.1 %

Incorrectly Classified Instances 269 26.9 %

Kappa statistic 0.2225

Mean absolute error 0.358

Root mean squared error 0.4375

Relative absolute error 85.1828 %

Root relative squared error 95.4666 %

Total Number of Instances 1000

=== Detailed Accuracy By Class ===

TP Rate FP Rate Precision Recall F-Measure MCC ROC Area PRC Area Class

0.940 0.757 0.744 0.940 0.830 0.263 0.700 0.818 good

0.243 0.060 0.635 0.243 0.352 0.263 0.700 0.473 bad

Weighted Avg. 0.731 0.548 0.711 0.731 0.687 0.263 0.700 0.714

=== Confusion Matrix ===

a b <-- classified as

658 42 | a = good

227 73 | b = bad

• Once the pruning process is complete, obtain the pruned decision tree model.
• Evaluate the accuracy of the pruned decision tree model using cross-validation and record the
obtained accuracy.
• Compare the accuracy of the pruned decision tree model with the accuracy of the original
decision tree model to assess the impact of Reduced Error Pruning on model accuracy.

To compare the pruned Decision Tree with the unpruned Decision Tree, follow these step-by-step
instructions:
• **Load the Dataset**:
- Go to the "Explorer" tab in Weka.
- Click on the "Open file" button and select the dataset file (.arff format) containing your
data, such as the credit-g.arff file for credit assessment.
• **Select Decision Tree Algorithm**:
- In the "Classify" tab, click on the "Choose" button to select the Decision Tree algorithm.
- Choose the J48 algorithm, which corresponds to the C4.5 Decision Tree algorithm .
• **Start the Training Process**:
- Once you have selected the J48 algorithm, click on the "Start" button to begin the
training process without enabling Reduced Error Pruning (REP).
• **View the Unpruned Decision Tree**:
- After the training process completes, It will generate the unpruned Decision Tree model.
- To view the unpruned Decision Tree:
- Go to the "Classify" tab.
- In the "Test options" section, click on the "More options" button.
- Check the box next to "Output model" to display the Decision Tree model.
- Click on the "Start" button in the "Test options" section to generate and display the
unpruned Decision Tree.
• **Record Accuracy and Decision Tree Structure**:
- Note down the accuracy of the unpruned Decision Tree model, which represents its
performance in accurately predicting outcomes.
- Also, observe the structure and complexity of the unpruned Decision Tree, including the
number of nodes, tree depth, and branching patterns.
• **Compare Pruned and Unpruned Decision Trees**:
- Once you have both the pruned and unpruned Decision Tree models, compare them
based on accuracy and complexity.
- Analyze how Reduced Error Pruning affected the Decision Tree's accuracy and structure
compared to the original unpruned Decision Tree.
RESULT :

We Have Successfully Evaluted impact of Reduced Impact of Reduced Error Pruning on model
Accuracy.

You might also like