Minggu, 13 Agustus 2023

Calculation of K-Nearest Neighbor with Euclidean Distance (5 Criteria)

In this post, I will discuss the calculation of K-Nearest Neighbor with Euclidean Distance using 5 criteria.

The classification that will be discussed is the Classification of Scholarship Recipients.

The data we will use is:
  • Consists of 10 data
  • Consists of 5 criteria
  • K = 5


Information :
  • What will be categorized consists of Mathematics scores, Indonesian scores, English scores, Science scores and Non-Academic scores.
  • Status consists of Not Qualified and Qualified.
  • What we will classify is Name = See, Mathematics Score = 81, Indonesian Score = 86, English Score = 79, Science Score = 93 and Non Academic Score = 87, Status = ?

Calculation (formula to be used) :


  • 79 is Alan's Math score
  • 81 is See's Math score
  • 88 is Alan's Indonesian score
  • 86 is See's Indonesian score
  • 72 is Alan's British value
  • 79 is See's British value
  • 92 is Alan's Science score
  • 93 is See's Science score
  • 97 is Alan's Non-Academic score
  • 87 is See's Non-Academic score
  • Then do the same calculations on data belonging to Dani, Rey and so on.

Then the calculation will be obtained as follows :


After that, do the ranking from the smallest to the largest value, the results obtained are as follows :


After getting the ranking, we can ensure that on behalf of See is eligible to receive a Scholarship or Not Eligible to receive a Scholarship.


Explanation :
  • If using K=1 then the result is Qualified because Dani's result is Qualified.
  • If using K=3 then the result is Not Qualified because Dani's result is Qualified, while Cee and Moon's result is Not Qualified (Qualified is 1 and Unqualified is 2).
  • If you use K=5 then the result is Not Qualified because Dani and Rey are Qualified, while Cee, Tet and Alan are Not Eligible (2 Qualified and 3 Unqualified).
So that the final result of See Not Qualifying.


Notes :
  • The value of K is independent (try to have an odd number so it doesn't confuse us when there are the same number of voting results).

Tidak ada komentar:

Posting Komentar