Lab Practices-III Fourth Year Computer Engineering Engineering

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Cons:

 Computationally expensive — because the algorithm stores all of the training data
 High memory requirement
 Stores all (or almost all) of the training data
 Prediction stage might be slow (with big N)
 Sensitive to irrelevant features and the scale of the data
Lab Practices-III Fourth Year Computer Engineering Engineering
3.9 Given Diagram Represent Positive and Negative Point with Color
In the following diagram let blue circles indicate positive examples and orange squares indicate negative examples. We
want to use k-NN algorithm for classifying the points. If k=3, find-the class of the point (6,6). Extend the same example
for Distance-Weighted k-NN and Locally weighted Averaging
3.10 Algorithm
1. Import the Required Packages
2. Read Given Dataset
3. Import KNeighborshood Classifier and create object of it.
4. Predict the class for the point(6,6) w.r.t to General KNN.
5. Predict the class for the point(6,6) w.r.t to Distance Weighted KNN.
3.11 Conclusion
In this way we learn KNN Classification to predict the General and Distance Weighted KNN for Given data point in term
of Positive or Negative.

You might also like