PROFESSIONAL-MACHINE-LEARNING-ENGINEER · Question #178
You are working with a dataset that contains customer transactions. You need to build an ML model to predict customer purchase behavior. You plan to develop the model in BigQuery ML, and export it…
The correct answer is B. Use the ML.ONE_HOT_ENCODER function on the categorical features and select the encoded. When developing a BigQuery ML model with categorical features for quick deployment to online prediction, explicitly using the ML.ONE_HOT_ENCODER function on those features and selecting their encoded output is the recommended approach.
Question
Options
- AUse the TRANSFORM clause with the ML.ONE_HOT_ENCODER function on the categorical
- BUse the ML.ONE_HOT_ENCODER function on the categorical features and select the encoded
- CUse the CREATE MODEL statement and select the categorical and non-categorical features.
- DUse the ML.MULTI_HOT_ENCODER function on the categorical features, and select the
How the community answered
(25 responses)- A4% (1)
- B76% (19)
- C16% (4)
- D4% (1)
Why each option
When developing a BigQuery ML model with categorical features for quick deployment to online prediction, explicitly using the `ML.ONE_HOT_ENCODER` function on those features and selecting their encoded output is the recommended approach.
While using the `TRANSFORM` clause with `ML.ONE_HOT_ENCODER` is robust for baking transformations into the model, explicitly selecting the encoded features may be considered a more direct or simpler step for rapid model definition and deployment in certain scenarios.
By explicitly applying the `ML.ONE_HOT_ENCODER` function to categorical features and selecting their encoded output for model training, you ensure the precise transformation desired for the model. This method provides direct control over the feature representation, which can streamline the model's structure and ensure consistency during the export and online prediction process for quicker deployment.
While BigQuery ML can automatically handle categorical features, explicitly using `ML.ONE_HOT_ENCODER` provides direct control over the specific encoding method, which can be beneficial for ensuring consistency and quick deployment, rather than relying on implicit defaults.
The `ML.MULTI_HOT_ENCODER` function is used for features with multiple values per row, which is not specified for these categorical features, and `ML.ONE_HOT_ENCODER` is the standard for distinct categorical values.
Concept tested: BigQuery ML categorical feature encoding
Source: https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-transform#mlone_hot_encoder
Topics
Community Discussion
No community discussion yet for this question.