
Answer-first summary for fast verification
Answer: Apply SQL in BigQuery to perform one-hot encoding on the city column, transforming each city into a separate column with binary values (0 or 1).
The correct approach is **B**, which involves using SQL in BigQuery to apply one-hot encoding to the city column. This method efficiently converts categorical city names into binary columns, enabling the linear regression model to utilize city information as a predictive feature without unnecessary complexity. - **Why not A?** Assigning cities to numerical regions may oversimplify the data, potentially diminishing the model's predictive accuracy by not fully capturing each city's unique characteristics. - **Why not C?** Removing city information altogether would eliminate a significant predictive variable, likely reducing the model's effectiveness. - **Why not D?** While TensorFlow offers powerful tools for handling categorical data, this approach introduces unnecessary complexity for the task at hand, as one-hot encoding can be directly accomplished within BigQuery using SQL.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are tasked with developing a linear regression model in BigQuery ML to predict the likelihood of a customer purchasing your company's products. The model uses city names as a key predictive factor. What is the most efficient way to structure your data into columns for training and deploying the model with minimal coding effort?
A
Utilize Cloud Data Fusion to categorize each city into regions labeled numerically (1, 2, 3, etc.), then use these numbers to represent cities in the model.
B
Apply SQL in BigQuery to perform one-hot encoding on the city column, transforming each city into a separate column with binary values (0 or 1).
C
Exclude the city information from your dataset by creating a new view in BigQuery that omits the city column.
D
Implement TensorFlow to create a categorical variable with a predefined vocabulary list, then upload this vocabulary file as part of your model to BigQuery ML.
No comments yet.