Google Professional Machine Learning Engineer Question 26
Select 2Google Cloud PlatformYou are a Machine Learning Engineer tasked with predicting customer churn for a telecommunications company. The company's data is stored in BigQuery, and you have created a logistic regression model using BigQuery ML. After training the model, you want to generate predictions for new customer data stored in a table named new_customers. Which SQL query should you use to generate predictions?
- A
SELECT * FROM ML.PREDICT(MODEL
project_id.dataset_name.churn_model, TABLEdataset_name.new_customers) - B
SELECT * FROM ML.EVALUATE(MODEL
project_id.dataset_name.churn_model, TABLEdataset_name.new_customers) - C
SELECT * FROM ML.FEATURE_IMPORTANCE(MODEL
project_id.dataset_name.churn_model, TABLEdataset_name.new_customers) - D
SELECT * FROM ML.PREDICT(MODEL
project_id.dataset_name.churn_model, TABLEproject_id.dataset_name.new_customers)
Show answer and explanation
Correct answers: A, D
Explanation
To generate predictions using a model in BigQuery ML, you use the ML.PREDICT function. The function requires the model's name and the table containing input data for predictions. Both options 1 and 4 are valid because they correctly use ML.PREDICT and reference the input data table. Option 1 assumes the dataset is in the same project, while option 4 includes the fully qualified table name, which is often necessary in multi-project setups.
- A. Correct.
Correct: This query correctly uses ML.PREDICT to generate predictions for the
new_customerstable. It follows the correct syntax and assumes the dataset is in the same project. - B. Incorrect.
Incorrect: ML.EVALUATE is used to calculate metrics such as accuracy or precision on a test dataset, not to generate predictions.
- C. Incorrect.
Incorrect: ML.FEATURE_IMPORTANCE is used to understand the importance of features in the model, but it does not generate predictions.
- D. Correct.
Correct: This query also correctly uses ML.PREDICT to generate predictions for the
new_customerstable. It includes the fully qualified table name with the project ID, which is required if the dataset is in a different project or when following best practices.