K Nearest Neighbors


For the K Nearest Neighbor ML model we tested four environments, both Red Wine and White Wine : all wine features vs the top 5 features. Based on the features importance test, the top 5 features for Red Wine were alcohol, density, residual sugar, free sulfur dioxide, and pH. The top 5 features for White Wine were alcohol, sulphates, volatile acidity, citric acid, and density. There are two possible predicted classes: "Fair (0)" and "Very Good (1)". When predicting the quality of wine, "very good" would mean to have better quality, and "fair" would mean to lower quality of wine. Based on the test accuracy scores for both Red and White wine, all features was a better test than just the top 5 features.

Red Wine

All Features

The test accuracy score for Red Wine: all features was 0.885

KKN Red Wine- All Features

The classifier made a total of 400 predictions, when considering all features. The classifier predicted “Fair (0)” 347 times and predicted “Very Good (1)” 2 times.

KKN Red Wine- Top 5 Features

Top 5 Features

The test accuracy score for Red Wine: for top 5 features was 0.863

KNN White Wine- All Features

The classifier made a total of 400 predictions, when considering the top 5 features. The classifier predicted “Fair (0)” 16 times and predicted “Very Good (1)” 53 times.

KNN White Wine- Top 5 Features

White Wine

All Features

The test accuracy score for White Wine: all features was 0.834

KKN Red Wine- All Features

The classifier made a total of 1225 predictions, when considering all features. The classifier predicted “Fair (0)” 941 times and predicted “Very Good (1)” 0 times.

KKN Red Wine- Top 5 Features

Top 5 Features

The test accuracy score for White Wine: for top 5 features was 0.811

KNN White Wine- All Features

The classifier made a total of 1225 predictions, when considering the top 5 features. The classifier predicted “Fair (0)” 889 times and predicted “Very Good (1)” 7 times.

KNN White Wine- Top 5 Features