Question: Consider the problem of finding the K nearest neighbors of a data object. A programmer designs Algorithm 2.1 for this task. Algorithm 2.1 Algorithm for
Consider the problem of finding the K nearest neighbors of a data object. A programmer designs Algorithm 2.1 for this task.
Algorithm 2.1
Algorithm for finding K nearest neighbors.
1: for i = 1 to number of data objects do
2: Find the distances of the ith object to all other objects.
3: Sort these distances in decreasing order.
(Keep track of which object is associated with each distance.)
4: Return the objects associated with the first K distances of the sorted list
5: End for
(a) Describe the potential problems with this algorithm if there are duplicate objects in the data set. Assume the distance function will only return a distance of 0 for objects that are the same.
(b) How would you fix this problem?
Algorithm 2.1
Algorithm for finding K nearest neighbors.
1: for i = 1 to number of data objects do
2: Find the distances of the ith object to all other objects.
3: Sort these distances in decreasing order.
(Keep track of which object is associated with each distance.)
4: Return the objects associated with the first K distances of the sorted list
5: End for
(a) Describe the potential problems with this algorithm if there are duplicate objects in the data set. Assume the distance function will only return a distance of 0 for objects that are the same.
(b) How would you fix this problem?
Step by Step Solution
★★★★★
3.37 Rating (178 Votes )
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
a There are several problems First the order of duplica... View full answer
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
Document Format (1 attachment)
908-M-S-D-A (8569).docx
120 KBs Word File
