nerdexam
Google

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.

Submitted by stefanr· Apr 18, 2026Data processing and feature engineering

Question

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 to Cloud Storage for online prediction. You notice that the input data contains a few categorical features, including product category and payment method. You want to deploy the model as quickly as possible. What should you do?

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)
  • A
    4% (1)
  • B
    76% (19)
  • C
    16% (4)
  • D
    4% (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.

AUse the TRANSFORM clause with the ML.ONE_HOT_ENCODER function on the categorical

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.

BUse the ML.ONE_HOT_ENCODER function on the categorical features and select the encodedCorrect

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.

CUse the CREATE MODEL statement and select the categorical and non-categorical features.

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.

DUse the ML.MULTI_HOT_ENCODER function on the categorical features, and select the

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

#BigQuery ML#Feature Engineering#Categorical Features#Online Prediction

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-MACHINE-LEARNING-ENGINEER Practice