...

/

k-NN Implementation Steps: 1 to 5

k-NN Implementation Steps: 1 to 5

This lesson will familiarize you with the implementation steps (1-5) of the k-nearest neighbor method.

1) Import libraries

This model is built using the KNeighborsClassifier from Scikit-learn. You’ll also be relying on StandardScaler to standardize the data, as you did earlier with principal component analysis.

Press + to interact
main.py
advertising.csv
#1- Import libraries
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import classification_report, confusion_matrix

Note ...