Feature Crosses for City-Specific ML Models
Short answer
C Use a single feature obtained as an element-wise product between binned latitude, binned longitude, and one-hot encoded car type to capture city-specific interactions.
Question
feature crosses should you use to train city-specific relationships between car type and number of sales?
Key Takeaways
Geographic variables like latitude and longitude must be crossed together to define a location; separating them fails to capture city-level interactions.
Learn how to build city-specific car sales prediction models using Google Cloud AI APIs by crossing binned geographic coordinates with categorical vehicle types.
Common mistake: Choosing Option D is a common trap. It separates latitude and longitude into different crosses, which prevents the model from understanding that a 'city' is the conjunction of both coordinates rather than two independent factors.
Expert Analysis
The core challenge is modeling city-specific relationships between car type and sales. A city is defined by the intersection of geographic coordinates, meaning latitude and longitude are not independent predictors of location identity; they must be combined to form a unique spatial identifier (a grid cell). If you cross them separately with car type (Option D), the model learns that 'latitude bin + sedan' affects sales and 'longitude bin + sedan' affects sales, but it cannot capture the specific interaction of 'this specific city block + sedan'. Therefore, the features must be crossed together first to create a granular location feature.
Binning is essential here because raw continuous coordinates would lead to sparse data (overfitting) since each coordinate pair might be unique. Bucketizing creates discrete regions. The correct approach is to perform a feature cross on the binned latitude and binned longitude to define the city area, and then incorporate the one-hot encoded car type. Option C describes creating a feature via the element-wise product of these three components, effectively creating a unique identifier for every combination of city-block and car type. This allows the linear model to assign a distinct weight to each specific relationship. As noted in community discussions, separating the dimensions (Option D) prevents the model from learning the true city-level context.
Official Reference
https://developers.google.com/machine-learning/crash-course/feature-crosses/check-your-understanding
This link opens the official vendor documentation in a new tab.
Exam Strategy
When asked about feature crosses for spatial or contextual dependencies, look for options that combine dependent variables (like lat/lon) into a single cross. Do not select options that treat highly correlated or conjunctive features as independent inputs, as this loses the joint information necessary for the target variable.
Frequently Asked Questions
Why can't I just use individual features for latitude, longitude, and car type?
Why is binning necessary for latitude and longitude?
Community Votes
88% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 21 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 21
-
Paul_Dirac 👍 22C https://developers.google.com/machine-learning/crash-course/feature-crosses/check-your-understanding
-
jk73 👍 13Cannot be D, Despite Binning is a good idea because it enables the model to learn nonlinear relationships within a single feature; separate latitude and longitude in different feature crosses is not a good one, this separation will prevent the model from learning city-specific sales. A city is the conjunction of latitude and longitude. In that order of Ideas Crossing binned latitude with binned longitude enables the model to learn city-specific effects of car type. I will go for C, https://developers.google.com/machine-learning/crash-course/feature-crosses/check-your-understanding
-
ebinv2 👍 8C should be the answer
-
Mohamed_Mossad 👍 6 Answered Chttps://developers.google.com/machine-learning/crash-course/feature-crosses/video-lecture
-
ralf_cc 👍 4D - https://developers.google.com/machine-learning/crash-course/feature-crosses/video-lecture
Show 16 more comments
-
A4M 👍 4C - Answer when doing feature cross the features need to be binned
-
MK_Ahsan 👍 3 Answered Chttps://developers.google.com/machine-learning/crash-course/feature-crosses/check-your-understanding Answer C: It needs a feature cross to obtain one feature.
-
NamitSehgal 👍 3I got with C
-
mayankblitzster 👍 2 Answered CCaptures City-Specific Relationships: Crossing binned latitude and longitude creates a unique identifier for a specific geographic area or "city block". Crossing this with the one-hot encoded car type allows the model to learn sales patterns that are specific to each car type within those defined city areas. Binning Handles Continuous Data: Binning (bucketizing) latitude and longitude converts these continuous values into discrete, categorical features, which are then suitable for feature crosses. Binning also enables the model to learn non-linear relationships within a single feature. Handles Non-Linearities and Interactions: Feature crosses, like this element-wise product, allow linear models to capture non-linear relationships and interactions between features, providing more predictive power than individual features alone
-
baimus 👍 2While i acknowledge the answer is C, It seems wrong to elementwise combine binned lat/lon, as it means there are at least 2 places with the same number in the world, probably more. Not only but by multiplying the binned a values it implies they are ordinal, but they are not ordinal in the same direction, so the relationship on price will be lost (a good example is northern countries tend to be richer, but the east/west relationship isn't defined)
-
george_ognyanov 👍 2Damn that was a good explanation. Thank you for writing it out.
-
Sum_Sum 👍 2C - everything else is madness
-
mayankblitzster 👍 1 Answered DTwo feature crosses as an element-wise product: the first between binned latitude and one-hot encoded car type, and the second between binned longitude and one-hot encoded car type. 🔍 Why? This approach allows the model to learn city-specific relationships between car types and sales by: Binning latitude and longitude: Groups nearby locations into discrete regions (e.g., cities or metro areas). One-hot encoding car types: Makes each car type a distinct feature. Crossing location bins with car types: Captures how preferences for car types vary by geographic region. By creating two separate feature crosses (latitude × car type and longitude × car type), the model can learn nuanced patterns without overcomplicating the feature space.
-
taylz876 👍 1 Answered CC- You need relationships that are specific to each city, meaning the effect of car type on sales depends on the city. Binning latitude and longitude turns locations into grid cells (roughly "cities"). Crossing the latitude bin, longitude bin and car type together creates one feature for each combination, like "this grid cell + this car type". The model can then learn a separate sales relationship for every city and car type pair.
-
ramen_lover 👍 1"element-wise product" sounds like we are not using a feature cross but artificially creating a new column whose values is the "element-wise product" of other column values...; i.e., (1, 2, 3) => 1 2 3 = 6. I am not a native English speaker; thus, I might misunderstand the sentence.
-
b7ad1d9 👍 1 Answered CC is the closest here. The REAL answer would be feature cross only Binned Latitude and Binned Longitude to get a feature that represents a city/location/sales area. There is no real need to also add the model in the feature cross. But given the choices C is the best fit.
-
rigori 👍 1creating this cross feature is madness from explainability standpoint
-
desertlotus1211 👍 1Would C be moe complex than D?
-
desertlotus1211 👍 1Why not Answer D?
-
PhilipKoku 👍 1 Answered CC) one feature
-
M25 👍 1 Answered CWent with C
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All PMLE Questions
Access 65 questions with complete answers and detailed explanations.
View Full PMLE Practice Test →