Question: Implement the kNN algorithm in python without using the libraries with both Euclidean and Manhattan distance and apply on the data given below: Age
Implement the kNN algorithm in python without using the libraries with both Euclidean and Manhattan distance and apply on the data given below: Age 25 35 45 20 35 52 23 40 60 48 33 Loan 40000 60000 80000 20000 120000 18000 95000 62000 100000 220000 150000 Default N N N N N N Y Y Y Y Y Income 102000 82000 62000 122000 22000 124000 47000 80000 42000 78000 8000 Generate the age randomly in the range 18 - 60 and Loan in the range 20000 150000. Income column may be kept the same. Now classify an unknown case (Age = 48, Loan = 142000, Income = 50000)
Step by Step Solution
3.36 Rating (149 Votes )
There are 3 Steps involved in it
income case2 default case3 euclideandist euclideandistanceage loan income unknowncase0 unknown... View full answer
Get step-by-step solutions from verified subject matter experts
