QuestionQ50

VerifiedAdvanced MLflow Usage

A machine learning engineer has built a machine learning pipeline that produces a scikit-learn model and calculates the RMSE rmse, MAE mae, and R-squared r2 values for the test set. They now need to log these values to the MLflow run. The values are held in the metrics dictionary.

They execute the following code block:

Question Image

The code block results in an error.

Which change to the code block will successfully complete the task?

Explanation

mlflow.log_metrics() logs multiple metrics for the active run from a dictionary mapping metric names to float values. In contrast, mlflow.log_metric() logs one metric and requires its name and value as separate arguments. Therefore, the dictionary containing RMSE, MAE, and R-squared values must be passed to mlflow.log_metrics().

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!