K-Nearest Neighbor as a Classification Algorithm: A Use Case — #70daysofMLStudy with Data Science Nigeria

Image Source: Google Image Search

GETTING THE REQUIRED DATA

  1. Visit the site using this link: https://archive.ics.uci.edu/ml/index.php . The homepage opens up as shown below, with links to the latest news, newest data uploads, most popular dataset et cetera.
UCI Machine Learning Repository

Reading/Importing the Dataset

  • Pandas — for data analysis/manipulation
  • Numpy — for Linear Algebra
  • ScikitLearn(Sklearn) — For modeling
  1. Import the required libraries
Importing the Libraries
Column/Attribute Description of the Dataset

DATA MANIPULATION/PREPROCESSING

Checking for missing entries/values
Dropping a column
Checking for unique entries
Checking for Datatypes

TRAINING THE ALGORITHM

Using Pandas
Using Numpy
Splitting the dataset
Fitting the data points into the classifying
Prediction
Reshaping and Predicting on a random sample data.

CONCLUSION

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store