Exam Certified Machine Learning Professional All QuestionsBrowse all questions from this exam
Question 52

A machine learning engineer wants to log and deploy a model as an MLflow pyfunc model. They have custom preprocessing that needs to be completed on feature variables prior to fitting the model or computing predictions using that model. They decide to wrap this preprocessing in a custom model class ModelWithPreprocess, where the preprocessing is performed when calling fit and when calling predict. They then log the fitted model of the ModelWithPreprocess class as a pyfunc model.

Which of the following is a benefit of this approach when loading the logged pyfunc model for downstream deployment?

    Correct Answer: C

    The custom model class ModelWithPreprocess ensures that the preprocessing logic is consistently applied during both the training and prediction phases. When the pyfunc model is logged and then later loaded for deployment, this preprocessing logic is encapsulated within the model itself. This means that when predictions are made using the pyfunc model, the same preprocessing steps will automatically be executed, ensuring consistency and correctness of predictions.

Discussion
hugodscarvalhoOption: C

Encapsulating the preprocessing logic within the custom model class, it ensures that the preprocessing steps are consistently applied both during model training and during prediction. When the pyfunc model is loaded for downstream deployment, the preprocessing logic is already integrated into the model, simplifying the deployment process and ensuring consistency in preprocessing across training and inference.

trendy01Option: C

C. The same preprocessing logic will automatically be applied when calling predict