ASSIGNMENT 7
Problem Statement: Load the Red Wine Quality dataset into WEKA Explorer and examine
it under the Preprocess tab. Check for class imbalance in the quality attribute. If imbalance
exists, apply techniques like Resample or SMOTE to balance the classes. Then, use a classifier
under the Classify tab with 10-fold cross-validation. Compare performance (accuracy,
precision, recall) before and after handling imbalance. Report your findings and comment on
the effect of balancing the data.
Solution:
1. Loading and Analyzing the Red Wine Quality Dataset in WEKA Explorer
The dataset is in ARFF format and consists of 11 numeric attributes (V1 to V11)
and a nominal class attribute Class with values {1,2,3,4,5,6} representing wine
quality.
Class Distribution Imbalance:
The dataset’s class attribute (Class) is categorical with values {1, 2, 3, 4, 5, 6},
representing different quality levels of wine.
Classes 3 and 4 are the majority classes, while 1, 2, 5, and 6 are underrepresented,
indicating an imbalance in the class distribution.
2. Applying Resample Technique in WEKA to Address Class Imbalance
Filter applied: Supervised > Instance > Resample
1
Parameter modified: BiasToUniformClass = 1.0
3. Classifier Evaluation on Imbalanced Dataset (Before Applying Resample)
Selected RandomForest from: Classify > Choose > trees > RandomForest
Set to 10-fold cross-validation to ensure a robust performance estimate.
2
4. Classifier Evaluation on Balanced Dataset (After Applying Resample)
Same classifier (RandomForest) and 10-fold cross-validation method used for
consistency.
5. Findings and Effect of Balancing the Data Using Resample
1. Accuracy Improved:
o Classifier accuracy increased from 70.61 % (before) to 89.35% (after
Resample).
2. Enhanced Precision and Recall:
o Precision and recall scores improved, especially for minority classes.
3. Reduced Class Bias:
o Model predictions became less biased toward majority classes.
4. Better Class Coverage:
o After resampling, the classifier showed more balanced performance across
all classes.
5. Conclusion:
o Resampling effectively handled class imbalance, leading to improved
overall classifier performance and fairer results.