K Nearest Neighbors - Project




K Nearest Neighbors Project


I've been given a classified data set from a company(fake data again..). It has hidden the feature column names but has given the data and the target classes.
I'll try to use KNN to create a model that directly predicts a class for a new data point based off of the features.


Import Libraries

I'll import libraries that I need to use as always





Get the Data






Exploratory Data Analysis


Since this data is artificial, I'll just do a large pairplot with seaborn.





Standardize the Variables


Time to standardize the variables.




Train Test Split




Using KNN







Predictions and Evaluations


















Choosing a K Value

after I saw accuracy is quite low, so I will pick a new K value.




Retrain with new K Value
  after I saw K value around 25-28 are quite okay, so I will pick K value at 27
























ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

Wine Quality Prediction(Logistic Regression) - Kaggle[Dataset]

Titanic - Kaggle