Why would you convert raw latitude and longitude coordinates into Haversine distances to key points of interest?

Quick Overview

Asks why a model should get great-circle distances to key points of interest in place of raw latitude and longitude columns. Tests geospatial feature engineering, how linear models and trees handle coordinates, and the distortion in distances computed on degrees.

Why would you convert raw latitude and longitude coordinates into Haversine distances to key points of interest?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why would you convert raw latitude and longitude coordinates into Haversine distances to key points of interest? Assume a tabular model, such as a house price or taxi fare model, where each row has a latitude and longitude column. ```hint Picture the signal Sketch what "close to the airport" looks like as a region in the (latitude, longitude) plane. How would a linear model or a decision tree carve out that region? ``` ```hint Check the units Is one degree of longitude the same distance everywhere on Earth? ``` ### What a Strong Answer Covers - Why raw coordinates are hard for linear models and trees to use when the target depends on proximity - What a distance feature gives the model, including how it generalizes to new locations - Why great-circle distance is used in place of Euclidean distance on raw degrees - What raw coordinates or cell features still add alongside distances - Pitfalls such as unit conversion and choosing points of interest without leaking the target ### Follow-up Questions - How would you compute the distance to the nearest of 50,000 stores for 10 million rows efficiently? - When is road distance or travel time a better feature than great-circle distance? - How would you pick which points of interest to measure distance to? - What do geohash or H3 cell features capture that distance features miss?

Overview: Asks why a model should get great-circle distances to key points of interest in place of raw latitude and longitude columns. Tests geospatial feature engineering, how linear models and trees handle coordinates, and the distortion in distances computed on degrees.

PracHub logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

Why would you convert raw latitude and longitude coordinates into Haversine distances to key points of interest?

Assume a tabular model, such as a house price or taxi fare model, where each row has a latitude and longitude column.

What a Strong Answer Covers Guidance

  • Why raw coordinates are hard for linear models and trees to use when the target depends on proximity
  • What a distance feature gives the model, including how it generalizes to new locations
  • Why great-circle distance is used in place of Euclidean distance on raw degrees
  • What raw coordinates or cell features still add alongside distances
  • Pitfalls such as unit conversion and choosing points of interest without leaking the target

Follow-up Questions Guidance

  • How would you compute the distance to the nearest of 50,000 stores for 10 million rows efficiently?
  • When is road distance or travel time a better feature than great-circle distance?
  • How would you pick which points of interest to measure distance to?
  • What do geohash or H3 cell features capture that distance features miss?