Databricks Machine Learning Professional Question 45
Select 2You are tasked with training a machine learning model using Hyperopt for hyperparameter tuning in Databricks. You need to ensure that all relevant metrics and parameters are automatically logged to MLflow for tracking and reproducibility. What steps should you take to enable autologging for this process?
- A
Use
mlflow.autolog()before starting the Hyperopt experiment. - B
Use
mlflow.start_run()within the Hyperopt optimization function to track each trial. - C
Call
mlflow.log_params()andmlflow.log_metrics()manually for each trial during the Hyperopt optimization. - D
Enable Hyperopt's MLflow integration by setting
enable_mlflow_logging=Truein thefmin()function. - E
Ensure the MLflow server is running in the Databricks workspace before initiating the Hyperopt experiment.
Show answer and explanation
Correct answers: A, D
Explanation
To enable autologging with Hyperopt in Databricks, you need to call mlflow.autolog() to activate automatic tracking for supported libraries, and you must also enable MLflow integration by setting enable_mlflow_logging=True in the fmin() function. These steps ensure that all relevant metrics, parameters, and artifacts are logged for each Hyperopt trial.
- A. Correct.
This is correct. Calling
mlflow.autolog()enables automatic logging of metrics, parameters, and artifacts for supported machine learning libraries, including Hyperopt, when used with Databricks. - B. Incorrect.
This is incorrect. While
mlflow.start_run()can manually start a run, it is not necessary when usingmlflow.autolog()as runs are automatically managed. - C. Incorrect.
This is incorrect. Manually logging parameters and metrics is not required when using autologging, as MLflow handles these automatically.
- D. Correct.
This is correct. Setting
enable_mlflow_logging=Truein thefmin()function ensures Hyperopt is integrated with MLflow for automatic tracking of runs. - E. Incorrect.
This is incorrect. While running the MLflow server might be necessary in other environments, Databricks automatically manages the MLflow server.