Question: Task 1 : Nearest Neibhour search using python in big data There is a datasets called restuarents the data set is consisted of 2 D

Task1: Nearest Neibhour search using python in big data
There is a datasets called restuarents the data set is consisted of 2D data points stored in a text file in following format:
id_1 x1 y1
id_2 x2 y2
.
.
.
id_n xn yn
each line includes a unique id for a point and its geographical coordinates, longititude and latitud. for example the entry in the dataset, precisely indicates the location of the restaurent. with "x" representing ongitude and "y" representing latitude.
Queries: we have 200 users interested in finding the nearest shop. Their locations are provided in a text file formatted identical to the datasets.
id_1 x_1 y_1
id_2 x_2 y_2
.
.
.
id_200 x_200 y_200
for example id_1=1, x_1=31.45, y_1=150.44 indicate's a user's location.
find the nearest restaurent for each query using the following algorithm:
1. sequential scan based method: calculate the distance between a query point to every point in the selected dataset to find the nearest neibhor.
The output should display in the following format:
The ID, x and y coordinates of the nearest neibhor identified for each query point
"id=56, x=34.15, y=149.21, for query 1"
the total running time for processing all 200 queries and the average time per query (divide the total running time by 200)
i want python code for the above requirements, assume that you have two data text files which is in the above format.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!