0
0
ML Pythonml~20 mins

Experiment tracking (MLflow) in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
MLflow Experiment Tracking Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the primary purpose of MLflow's experiment tracking?
MLflow helps data scientists keep track of their machine learning experiments. What is the main goal of using MLflow's experiment tracking feature?
ATo automatically tune hyperparameters without user input
BTo store and compare parameters, metrics, and models from different runs
CTo deploy models directly to production without testing
DTo visualize data distributions before training
Attempts:
2 left
💡 Hint
Think about what you want to remember and compare after running many models.
Predict Output
intermediate
2:00remaining
What output does this MLflow code produce?
Consider this Python code snippet using MLflow to log a parameter and a metric. What will be printed?
ML Python
import mlflow
with mlflow.start_run():
    mlflow.log_param('alpha', 0.5)
    mlflow.log_metric('rmse', 1.23)
    print(mlflow.active_run().info.run_id)
AThe value 1.23
BThe value 0.5
CA unique run ID string like '1234abcd...'
DNone
Attempts:
2 left
💡 Hint
mlflow.active_run().info.run_id returns a string identifier for the current run.
Model Choice
advanced
1:30remaining
Which MLflow model flavor is best for saving a scikit-learn model?
You trained a scikit-learn model and want to save it with MLflow so you can load it later easily. Which MLflow model flavor should you use?
Amlflow.spark
Bmlflow.tensorflow
Cmlflow.pytorch
Dmlflow.sklearn
Attempts:
2 left
💡 Hint
Match the model flavor to the library you used for training.
Hyperparameter
advanced
1:30remaining
Which hyperparameter logging method correctly records multiple hyperparameters in MLflow?
You want to log multiple hyperparameters at once in MLflow. Which code snippet correctly does this?
Amlflow.log_params({'learning_rate': 0.01, 'batch_size': 32})
Bmlflow.log_params(['learning_rate=0.01', 'batch_size=32'])
Cmlflow.log_param(['learning_rate', 0.01, 'batch_size', 32])
Dmlflow.log_param({'learning_rate': 0.01, 'batch_size': 32})
Attempts:
2 left
💡 Hint
Check the method name and argument type for logging multiple parameters.
Metrics
expert
2:00remaining
What is the value of 'accuracy' after running this MLflow code?
Given this code snippet, what will be the final logged value of the metric 'accuracy'?
ML Python
import mlflow
with mlflow.start_run():
    mlflow.log_metric('accuracy', 0.8)
    mlflow.log_metric('accuracy', 0.85)
    mlflow.log_metric('accuracy', 0.83, step=1)
    mlflow.log_metric('accuracy', 0.9, step=2)
    run = mlflow.active_run()
    metrics = mlflow.get_run(run.info.run_id).data.metrics
    print(metrics['accuracy'])
A0.85
B0.9
C0.83
D0.8
Attempts:
2 left
💡 Hint
Without step argument, the last logged metric overwrites previous ones at step 0.