Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Associate Data Practitioner practice bank has 1,132 more like it. Try 10 free: instant score, no account.
A data analyst at an e-commerce company trained a linear regression model named sales_models.order_value_predictor using BigQuery ML to estimate the total purchase amount of customer orders. The analyst now has a newly collected test dataset stored in sales_data.recent_orders that includes input features as well as the actual completed order amounts. The analyst needs to assess the predictive accuracy of the model on this new dataset by generating summary performance metrics, including mean absolute error and R² score.
Which BigQuery ML statement should the analyst execute?
ML.CONFUSION_MATRIX is a BigQuery ML evaluation function designed exclusively for classification models (such as binary or multiclass logistic regression, boosted trees, or random forest classifiers). It generates a matrix table showing the counts of actual versus predicted categorical classes.
ML.CONFUSION_MATRIX reports true positives, false positives, true negatives, and false negatives. It cannot calculate regression error metrics such as mean absolute error (MAE) or R² score.ML.CONFUSION_MATRIX against a regression model will result in a query execution error in BigQuery.The analyst had trained a classification model (such as a logistic regression model predicting whether an order would be fraudulent: TRUE or FALSE) and wanted to examine false positive and false negative counts on a test dataset.
Regression models and classification models evaluate accuracy in completely different ways. Regression models rely on distance-based metrics (such as MAE and MSE), while classification models rely on class distribution matrices and threshold metrics (such as precision, recall, and confusion matrices).
ML.PREDICT is the primary inference function in BigQuery ML. It takes a trained model and an input dataset, applies the model's learned patterns to each row, and generates individual predictions alongside the original input columns.
ML.PREDICT outputs individual rows with a new column prefixed with predicted_ (such as predicted_order_value). It does not aggregate these predictions into statistical summary metrics like mean absolute error (MAE), mean squared error (MSE), or R² score.AVG, ABS, POW, etc.) to calculate summary performance metrics.The goal was to generate batch predictions on new order data to estimate transaction amounts for downstream reporting dashboards or operational workflows, rather than measuring overall model quality against actual outcomes.
In machine learning workflows, inference (ML.PREDICT) and evaluation (ML.EVALUATE) represent two distinct stages. Inference operationalizes the model by generating estimated labels, whereas evaluation measures the model's statistical validity.
ML.WEIGHTS is an inspection function in BigQuery ML that displays the numerical weights, coefficients, and bias terms learned by the model for each feature during training.
ML.WEIGHTS inspects the internal parameters of the model itself and does not take a test dataset (TABLE sales_data.recent_orders) as an argument.The analyst wanted to examine the internal coefficients of the linear regression formula to identify which customer attributes had the highest positive or negative impact on predicted order value.
Inspecting weights is a model explainability technique used to understand model mechanics, whereas evaluating predictions against real-world observations requires evaluation functions like ML.EVALUATE.
ML.EVALUATE is a built-in BigQuery ML function designed to compute quantitative performance metrics for a trained machine learning model. It assesses model quality by comparing predicted outcomes against actual ground-truth label values present in an evaluation dataset.
sales_models.order_value_predictor) and a new evaluation table (TABLE sales_data.recent_orders). BigQuery ML runs inference internally on the input table and compares those predictions with the table's actual label column.ML.EVALUATE automatically computes and outputs key regression metrics, specifically:
TABLE dataset.table) or a subquery (SELECT ...) to filter evaluation records on the fly.ML.EVALUATE provides an all-in-one, standardized approach to model validation. Rather than running inference with ML.PREDICT and writing custom SQL statements to compute differences, squares, and averages manually, ML.EVALUATE generates mathematically rigorous evaluation metrics in a single query.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated