Databricks Machine Learning Professional Question 46
Select 3A data scientist is building an ML model using Databricks and wants to use MLflow autologging to track model parameters, metrics, and artifacts during training. They are using Hyperopt for hyperparameter tuning. What steps must they take to enable autologging and ensure it works with Hyperopt?
- A
Enable MLflow autologging by calling
mlflow.autolog()before running the Hyperopt experiment. - B
Use the
mlflow.log_param()andmlflow.log_metric()functions explicitly within the objective function passed to Hyperopt. - C
Use the
fmin()function from Hyperopt to define and execute the optimization process. - D
Ensure the
mlflow.start_run()context is used explicitly within the objective function when autologging is required. - E
Import and call
mlflow.hyperopt.fmin()instead of Hyperopt’s standardfmin()to integrate autologging seamlessly.
Show answer and explanation
Correct answers: A, C, E
Explanation
To enable MLflow autologging with Hyperopt, the user must first call mlflow.autolog() to activate autologging functionality. Then, they can use the fmin() function from Hyperopt to execute the optimization process. Additionally, to ensure seamless integration of Hyperopt and MLflow, they should use mlflow.hyperopt.fmin() instead of the standard Hyperopt fmin(). This ensures that all relevant parameters, metrics, and artifacts are automatically logged without requiring explicit manual logging.
- A. Correct.
Correct. Enabling MLflow autologging by calling
mlflow.autolog()is required to ensure MLflow automatically tracks parameters, metrics, and artifacts during model training. - B. Incorrect.
Incorrect. Explicit calls to
mlflow.log_param()andmlflow.log_metric()are unnecessary when using MLflow autologging, as it automatically tracks this information. - C. Correct.
Correct. The
fmin()function from Hyperopt is used to execute the optimization process and is a necessary step in hyperparameter tuning. - D. Incorrect.
Incorrect. Explicitly using
mlflow.start_run()is not required when MLflow autologging is enabled, as it automatically creates and manages runs during the optimization process. - E. Correct.
Correct. Using
mlflow.hyperopt.fmin()integrates Hyperopt with MLflow autologging, enabling seamless tracking of hyperparameter tuning results.