Question 28
Domain 4: Deploy and operationalize machine learning solutionsYou have built a custom model that uses multiple elements from different frameworks. You need to log the model. What should you use?
Correct answer: A
Explanation
Use "mlflow.pyfunc" because MLflow’s PyFunc flavor is designed for custom Python models that combine logic from multiple frameworks behind a single interface. It lets you "log the model" as a generic Python function model, so the mixed-framework implementation can be packaged and served consistently.
Why each option is right or wrong
A. mlflow.pyfunc
MLflow’s Python function flavor is the generic wrapper used when a model does not fit a single native framework flavor. The `mlflow.pyfunc.log_model()` API logs a custom model by packaging it as a PyFunc model, which is the supported mechanism for mixed-framework logic behind one callable interface.
B. mlflow.autolog()
C. mlflow.log_params()
D. mlflow.<flavor>.load_model() **Correct answer:** A. mlflow.pyfunc **Explanation:** You should use the `mlflow.pyfunc` module to log custom models that combine multiple frameworks or inference logic not natively supported by MLflow. This module defines a generic file-system format for Python models and provides utilities to save and load them in that format. **Reference:** - [MLflow pyfunc documentation](https://mlflow.org/docs/latest/python_api/mlflow.pyfunc.html) ---