Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to log a model artifact using MLflow.
MLOps
import mlflow mlflow.[1].log_model(model, "model")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using mlflow.log instead of mlflow.pyfunc.log_model
Trying to log model directly without specifying the module
✗ Incorrect
Use mlflow.pyfunc.log_model to log a model artifact in MLflow.
2fill in blank
mediumComplete the code to log an artifact file in MLflow.
MLOps
with mlflow.start_run(): mlflow.[1]("output.txt")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using mlflow.log_param instead of mlflow.log_artifact
Trying to log artifact outside a run context
✗ Incorrect
Use mlflow.log_artifact to log files as artifacts.
3fill in blank
hardFix the error in the code to log a model with MLflow.
MLOps
mlflow.[1].log_model(model, "model")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Calling mlflow.log_model directly without module
Using mlflow.artifacts to log models
✗ Incorrect
Use mlflow.sklearn.log_model to log scikit-learn models properly.
4fill in blank
hardFill both blanks to log a model and an artifact inside a run.
MLOps
with mlflow.[1](): mlflow.sklearn.[2](model, "model")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not starting a run before logging
Using log_artifact to log models
✗ Incorrect
Use mlflow.start_run() to start a run and mlflow.sklearn.log_model to log the model.
5fill in blank
hardFill all three blanks to log a model, an artifact, and end the run properly.
MLOps
mlflow.[1]() mlflow.sklearn.[2](model, "model") mlflow.[3]("output.txt")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Logging without starting a run
Confusing log_model and log_artifact methods
✗ Incorrect
Start the run with start_run(), log the model and artifact, then end the run if needed.