KNN Ques
KNN Ques
Practice problems
Q1
Q1
• let's assume the value of K is 5.
• Here's the new data entry:
Sol 1
• To know its class, we have to calculate the distance from
the new entry to other entries in the data set using the
Euclidean distance formula.
• Here's the formula: √(X₂-X₁)²+(Y₂-Y₁)²
• Where:
X₂ = New entry's brightness (20).
X₁= Existing entry's brightness.
Y₂ = New entry's saturation (35).
Y₁ = Existing entry's saturation.
• Distance #1
• For the first row, d1:
Take k=3