|
Algorithm 3 Determine the Nearest Neighbor |
-
1:
procedure NearestNeighbor(, )
-
2:
Group by region_id
-
3:
for each region_id i do
-
4:
w = 0, t = 0
-
5:
for j in (length([i]) do
-
6:
t = pow(([j][‘mean’] − [i][j][‘mean’]), 2)
-
7:
t = t × [i][j][‘weight’]
-
8:
w += t
-
9:
[i] = [, [i][j][‘timestamp’].mean(), w]
-
10:
return .minimum() ▹ Return region with lowest weight
|