Databricks Machine Learning Associate Question 105
Select 3You are developing a machine learning pipeline in Databricks and want to track the performance of multiple models trained within a single pipeline execution. You decide to use nested MLflow runs to organize the tracking data. Which of the following steps are required to correctly create and log nested runs in MLflow?
- A
Start a parent MLflow run using mlflow.start_run() and set 'nested=True'.
- B
Start the parent MLflow run without any arguments using mlflow.start_run().
- C
Start a child MLflow run using mlflow.start_run(nested=True) within the context of an active parent run.
- D
Log metrics and parameters for the child runs only after calling mlflow.end_run() on the parent run.
- E
Ensure that mlflow.end_run() is called for each child run before ending the parent run.
Show answer and explanation
Correct answers: B, C, E
Explanation
To create nested MLflow runs, the parent run must first be started using mlflow.start_run() without the 'nested=True' argument. Within the active parent run, nested child runs can be created by calling mlflow.start_run(nested=True). Each child run should be ended with mlflow.end_run() before ending the parent run to ensure proper tracking and organization of metrics and parameters across all runs.
- A. Incorrect.
This is incorrect because the 'nested=True' argument is only applicable when creating child runs and not for parent runs.
- B. Correct.
This is correct because the parent MLflow run must be started without the 'nested=True' argument, as it is a standalone run.
- C. Correct.
This is correct because nested child runs are created by passing 'nested=True' when calling mlflow.start_run() within the context of an active parent run.
- D. Incorrect.
This is incorrect because metrics and parameters can be logged to child runs while the parent run is still active. Ending the parent run is not a prerequisite for logging child run data.
- E. Correct.
This is correct because each child run must be properly ended by calling mlflow.end_run() before ending the parent run to maintain proper organization and avoid tracking errors.