nerdexam
Google

PROFESSIONAL-MACHINE-LEARNING-ENGINEER · Question #186

You have recently trained a scikit-learn model that you plan to deploy on Vertex AI. This model will support both online and batch prediction. You need to preprocess input data for model inference…

The correct answer is B. 1. Wrap your model in a custom prediction routine (CPR). and build a container image from the. To deploy a scikit-learn model on Vertex AI for online and batch prediction with custom preprocessing and minimal code, wrap the model in a Custom Prediction Routine (CPR).

Submitted by amina.ke· Apr 18, 2026ML pipeline operationalization

Question

You have recently trained a scikit-learn model that you plan to deploy on Vertex AI. This model will support both online and batch prediction. You need to preprocess input data for model inference. You want to package the model for deployment while minimizing additional code. What should you do?

Options

  • A
    1. Upload your model to the Vertex AI Model Registry by using a prebuilt scikit-ieam prediction
  • B
    1. Wrap your model in a custom prediction routine (CPR). and build a container image from the
  • C
    1. Create a custom container for your scikit learn model.
  • D
    1. Create a custom container for your scikit learn model.

How the community answered

(28 responses)
  • A
    4% (1)
  • B
    71% (20)
  • C
    18% (5)
  • D
    7% (2)

Why each option

To deploy a scikit-learn model on Vertex AI for online and batch prediction with custom preprocessing and minimal code, wrap the model in a Custom Prediction Routine (CPR).

A1. Upload your model to the Vertex AI Model Registry by using a prebuilt scikit-ieam prediction

Using a prebuilt scikit-learn prediction container typically assumes input data is already in the expected format for the model and does not easily accommodate custom preprocessing logic without further modification or a custom handler.

B1. Wrap your model in a custom prediction routine (CPR). and build a container image from theCorrect

A Custom Prediction Routine (CPR) allows you to define a `Predictor` class with custom preprocessing logic, model inference, and post-processing. Vertex AI then uses this to build a container image, embedding your custom code and minimizing the boilerplate container setup required, which is ideal for incorporating preprocessing with minimal effort.

C1. Create a custom container for your scikit learn model.

Creating a fully custom container requires writing a complete Dockerfile and serving script, which involves significantly more code and effort compared to leveraging a Custom Prediction Routine that abstracts much of the containerization boilerplate.

D1. Create a custom container for your scikit learn model.

This choice is a duplicate of C and, similarly, involves more manual effort for container creation and setup than using a Custom Prediction Routine for embedding custom logic.

Concept tested: Vertex AI Custom Prediction Routines, model deployment with preprocessing

Source: https://cloud.google.com/vertex-ai/docs/predictions/custom-prediction-routines

Topics

#Vertex AI Deployment#Custom Prediction Routine#Model Preprocessing#Scikit-learn

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-MACHINE-LEARNING-ENGINEER Practice