0
0
MLOpsdevops~10 mins

Logging parameters and metrics in MLOps - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to log a parameter using MLflow.

MLOps
mlflow.log_param("learning_rate", [1])
Drag options to blanks, or click blank then click option'
A0.01
Blearning_rate
C"0.01"
Dparam
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the number inside quotes makes it a string, which is allowed but not typical for numeric parameters.
Using variable names without defining them causes errors.
2fill in blank
medium

Complete the code to log a metric named 'accuracy' with a value of 0.95.

MLOps
mlflow.log_metric("accuracy", [1])
Drag options to blanks, or click blank then click option'
A0.95
Bmetric
Caccuracy
D"0.95"
Attempts:
3 left
💡 Hint
Common Mistakes
Using strings instead of numbers for metric values.
Confusing metric names with values.
3fill in blank
hard

Fix the error in logging a parameter where the variable 'lr' holds the learning rate.

MLOps
mlflow.log_param("learning_rate", [1])
Drag options to blanks, or click blank then click option'
Alearning_rate
Blr
C"lr"
DlearningRate
Attempts:
3 left
💡 Hint
Common Mistakes
Passing variable names as strings instead of variables.
Using undefined variable names.
4fill in blank
hard

Fill both blanks to log a metric 'f1_score' with value stored in variable 'score'.

MLOps
mlflow.log_metric([1], [2])
Drag options to blanks, or click blank then click option'
A"f1_score"
Bscore
Cf1_score
D"score"
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without quotes for metric names.
Putting variable names inside quotes for values.
5fill in blank
hard

Fill all three blanks to log parameters and metrics in a run.

MLOps
with mlflow.start_run():
    mlflow.log_param("batch_size", [1])
    mlflow.log_metric("accuracy", [2])
    mlflow.log_metric("loss", [3])
Drag options to blanks, or click blank then click option'
A32
B0.89
C0.12
Dbatch_size
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names instead of values.
Putting numeric values inside quotes.