-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Details of the Baseline HMM #10
Comments
Linear + HMM first performs linear interpolation without road segment information, i.e., on Euclidean space, and then performs map matching. |
We provide a simple code of linear interpolation of GPS trajectory below: def process_trajectory(record, epsilon, interpolate_func, roadmap=None):
if len(record) == 0:
return []
timestamp = {}
count = [0 for _ in range(epsilon)]
for item in record:
timestamp[int(item[0])] = [int(item[0]), float(item[1]), float(item[2]), int(item[3])]
count[int(item[0]) % epsilon] += 1
m = np.argmax(count)
st = int(record[0][0])
while st % epsilon != m:
st += 1
en = int(record[-1][0])
processed_traj = []
while st <= en:
if st in timestamp:
processed_traj.append(timestamp[st])
else:
pre = st
while pre not in timestamp:
pre -= 1
post = st
while post not in timestamp:
post += 1
if roadmap is not None:
gps = interpolate_func(timestamp[pre], timestamp[post], st, roadmap)
else:
gps = interpolate_func(timestamp[pre], timestamp[post], st)
if gps[0] == -1:
processed_traj.append([st, timestamp[pre][1], timestamp[pre][2], -997])
else:
processed_traj.append(gps)
st += epsilon
return processed_traj
def noiseInterpolate(pre, post, time):
gps_pre = [pre[1], pre[2]]
gps_post = [post[1], post[2]]
time_pre = time - pre[0]
time_post = post[0] - time
cluster = [gps_pre for _ in range(time_post)] + [gps_post for _ in range(time_pre)]
return [time, *center_geolocation(cluster), pre[-1]]
process_trajectory(record, epsilon, noiseInterpolate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do you evaluate on HMM? According to the data preprocessing flow you provided, your ground truth is obtained by interpolation followed by HMM matching, is the evaluation also conducted by first interpolating and then using HMM matching?
The text was updated successfully, but these errors were encountered: