Answer to Question #319741 in Python for Anino

Question #319741

Part 3: KNN

  • Apply the kNN classifier to the Iris data (using 3 neighbors and unweighted distances).
  • Output the classification report and confusion matrix and submit a screenshot of the result (1 mark).
1
Expert's answer
2022-03-28T16:11:06-0400
iris = datasets.load_iris()
X = iris.data[:, :2]  
y = iris.target
from sklearn.neighbours import KNeighbourClassifier
classifier = KNeighbourClassifier(n_neighbour=3)
classifier.fit(X, y)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS