nerdexam
DatabricksDatabricks

CERTIFIED-MACHINE-LEARNING-PROFESSIONAL · Question #17

CERTIFIED-MACHINE-LEARNING-PROFESSIONAL Question #17: Real Exam Question with Answer & Explanation

The correct answer is A: mlflow.spark.track_model(sklearn_model, "model"). There's an error in the provided answer key. The marked correct answer (A) is actually wrong - let me explain what the correct answer actually is and why. Option B is the correct answer: mlflow.sklearn.log_model(sklearn_model, "model") MLflow organizes logging functions by framew

Question

A data scientist has developed a scikit-learn model sklearn_model and they want to log the model using MLflow. They write the following incomplete code block: Which of the following lines of code can be used to fill in the blank so the code block can successfully complete the task?

Options

  • Amlflow.spark.track_model(sklearn_model, "model")
  • Bmlflow.sklearn.log_model(sklearn_model, "model")
  • Cmlflow.spark.log_model(sklearn_model, "model")
  • Dmlflow.sklearn.load_model("model")
  • Emlflow.sklearn.track_model(sklearn_model, "model")

Explanation

There's an error in the provided answer key. The marked correct answer (A) is actually wrong - let me explain what the correct answer actually is and why.

Option B is the correct answer: mlflow.sklearn.log_model(sklearn_model, "model")

MLflow organizes logging functions by framework under mlflow.<framework>.log_model(model, artifact_path). For a scikit-learn model, the correct module is mlflow.sklearn, and log_model is the function used to serialize and log the model as an artifact in the active MLflow run.

Why each distractor is wrong:

  • A (mlflow.spark.track_model) - wrong module (spark is for PySpark models) and track_model is not a real MLflow function.
  • C (mlflow.spark.log_model) - wrong module; this would be used for a Spark MLlib model, not sklearn.
  • D (mlflow.sklearn.load_model) - correct module, but load_model retrieves a previously logged model; it does not log one.
  • E (mlflow.sklearn.track_model) - correct module, but track_model does not exist in the MLflow API.

Memory tip: Think of the pattern mlflow.<framework>.log_model(model, path) - match the framework name to your library (sklearn, spark, tensorflow, pytorch, etc.), and remember that log = save/write, load = read/retrieve.

Note for exam takers: The answer key provided in this question contains an error. If you encounter this on a real exam, select B.

Community Discussion

No community discussion yet for this question.

Full CERTIFIED-MACHINE-LEARNING-PROFESSIONAL PracticeBrowse All CERTIFIED-MACHINE-LEARNING-PROFESSIONAL Questions