Q. Implement K-Nearest Neighbours Algorithm On Iris Dataset For Different Values of K. You Can Implement For K 4,5,6,7,8
Q. Implement K-Nearest Neighbours Algorithm On Iris Dataset For Different Values of K. You Can Implement For K 4,5,6,7,8
Q. Implement k-Nearest Neighbours algorithm on Iris dataset for different values of k. You can
implement for k = 4,5,6,7,8.
ANS:-
# Import necessary modules
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Data loading
iris = pd.read_csv("Iris.csv")
print(iris.head(10))