This repository contains Python code implementing a KNN classifier for the Car Evaluation Data Set as part of a Machine Learning course project at my study in the University of Ottawa in 2023.
- Required libraries: scikit-learn, pandas, matplotlib.
- Execute cells in a Jupyter Notebook environment.
- The uploaded code has been executed and tested successfully within the Google Colab environment.
Task is to classify the car dataset into 4 classes: Unacceptable /Acceptable /Good /Very good.
- 'Buying': buying price
- 'Maint': maintenance price
- 'Doors': numbers of doors
- 'Persons': capacity in terms of persons to carry
- 'Lug_boot': Size of luggage boot
- 'Safety': estimated safety of the car
- 'Evaluation'
-
Data Preparation:
-
Preprocessing:
- Transformed categorical string attributes into numerical representations, enabling the application of distance-based metrics, such as Euclidean distance, crucial for KNN classification.
-
Exploring Training Sample Sizes:
-
Investigated the influence of diverse training sample sizes (ranging from 10% to 100% of the training set) on model performance.
-
Evaluated and measured accuracy on both the validation and test sets, discerning the impact of varying training sample sizes on model accuracy.
- Using 10%-40% from the training set means, that the training set size is less than the validation and test set size so validation and testing accuracy in these points are meaningless because the model didn’t train enough.
- From 50% - 100% our model starts to train well until reaches to 100% with the best validation and testing accuracy.
-
-
Optimization of K Value: