knn as classifier firststart with importing necessary python packagesimport numpy as np import matplotlib pyplot as plt import pandas as pd nextdownload the iris dataset from its weblink as followspath "nextwe need to assign column names to the dataset as followsheadernames ['sepal-length''sepal-width''petal-length''petal-width''class'nowwe need to read dataset to pandas dataframe as followsdataset pd read_csv(pathnames=headernamesdataset head( sepal-length sepal-width petal-length petal-width class iris-setosa iris-setosa iris-setosa iris-setosa iris-setosa data preprocessing will be done with the help of following script linesx dataset iloc[::- values dataset iloc[: values nextwe will divide the data into train and test split following code will split the dataset into training data and of testing datafrom sklearn model_selection import train_test_split x_trainx_testy_trainy_test train_test_split(xytest_size= nextdata scaling will be done as followsfrom sklearn preprocessing import standardscaler scaler standardscaler(scaler fit(x_trainx_train scaler transform(x_train