Implement SIP - #321
Conversation
| + np.cos(lat_1) * np.cos(lat_2) * np.sin(dlon / 2) ** 2 | ||
| ) | ||
| return 2 * _EARTH_RADIUS_M * np.arcsin(np.sqrt(a)) | ||
| return np.linalg.norm(query_coords[stop_1] - query_coords[stop_2], axis=1) |
There was a problem hiding this comment.
A function like this already exists in nomad/stop_detection/utils.py#L154 , something like temporal_blocking also exists, but I'm not super convinced it is necessary here.
Please integrate and avoid redundancy.
There was a problem hiding this comment.
I replaced _pair_distances with _haversine_distance. For temporal blocking, it's not strictly necessary, but I feel like it is still worth including as a performance upgrade; I saw speedup on the order of 10x when I tested on 500 users.
…darren-contact-sip
…darren-contact-sip
| from sklearn.neighbors import BallTree, KDTree | ||
|
|
||
|
|
||
| _EARTH_RADIUS_M = 6_371_000 |
There was a problem hiding this comment.
I suppose once PR #403 is merged this should just be constants.EARTH_RADIUS_METERS
| stop_2 = pairs["stop_2"].to_numpy() | ||
| keep = ( | ||
| (stop_1 < stop_2) | ||
| & (users[stop_1] != users[stop_2]) |
There was a problem hiding this comment.
what if both user ids are missing, would this evaluate to true? Then we would get a false contact? Not sure if/where we check for missing user_ids
Adds contact-based SIP MVP:
location_idor radius distance