Databricks Machine Learning Associate Question 108
Single answerYou are training a machine learning model in Databricks and decide to log metrics and parameters for multiple training stages (e.g., data preprocessing, model training, and evaluation) separately but within the same experiment. How can you achieve this using MLflow?
- A
Use MLflow's nested runs feature by starting a parent run and creating child runs for each stage.
- B
Log metrics and parameters for each stage in separate experiments.
- C
Use tags to differentiate metrics and parameters for each stage within a single run.
- D
Start a new MLflow experiment for each stage and log its respective metrics and parameters.
Show answer and explanation
Correct answer: A
Explanation
Nested runs in MLflow allow you to create a parent run and associate child runs with it, enabling a clear hierarchical organization of metrics, parameters, and artifacts for complex workflows. This is particularly useful in scenarios where multiple stages of an experiment need to be tracked separately but within the same overarching context.
- A. Correct.
Correct: MLflow supports nested runs, which allow you to organize and track different stages of an experiment within a single parent run. This is ideal for tracking metrics and parameters for hierarchical workflows.
- B. Incorrect.
Incorrect: Logging metrics and parameters in separate experiments is not the recommended approach for hierarchical workflows, as it fragments the tracking and makes it harder to maintain organization within a single experiment.
- C. Incorrect.
Incorrect: While tags can provide some level of differentiation, they do not inherently create a hierarchical structure for tracking multiple stages of an experiment.
- D. Incorrect.
Incorrect: Starting a new MLflow experiment for each stage is unnecessary and counterproductive, as it breaks the continuity of the tracking for the overall experiment.