Complete the code to save the pipeline version using MLflow.
mlflow.set_experiment('my_experiment') with mlflow.start_run(): mlflow.log_param('pipeline_version', [1])
Pipeline version should be a string like 'v1.0.0' to track reproducible runs.
Complete the code to load a specific pipeline version from the registry.
from mlflow import pyfunc model = pyfunc.load_model('models:/my_pipeline/[1]')
Loading the 'production' stage ensures you get the stable pipeline version.
Fix the error in the code to ensure pipeline reproducibility by pinning dependencies.
import subprocess def save_requirements(): with open('requirements.txt', 'w') as f: f.write([1])
Using subprocess.check_output captures the output of 'pip freeze' as a string and writes it to the file correctly.
Fill both blanks to create a reproducible pipeline run with a fixed random seed.
import random import numpy as np random.[1](42) np.random.[2](42)
Setting the seed for both random and numpy.random ensures reproducible randomness.
Fill all three blanks to log pipeline metadata with MLflow for reproducibility.
mlflow.log_param('[1]', 'v1.0.0') mlflow.log_param('[2]', 'my_experiment') mlflow.log_param('[3]', '2024-06-01')
Logging 'pipeline_version', 'experiment_name', and 'start_date' helps track pipeline runs clearly.