Interview Prep/MLOps/Experiment tracking & model registry

How do you log a training run to MLflow in Python?

IntermediateHands-onExperiment tracking & model registry
Answer

Set the tracking URI, then inside with mlflow.start_run(): call mlflow.log_params({...}) for hyperparameters, train the model, mlflow.log_metrics({"auc": auc}) for results, and mlflow.sklearn.log_model(model, "model", registered_model_name="churn") to save and register it. The run then appears in the MLflow UI.

All MLOps questions Roadmap: MLOps pipelines

More on Experiment tracking & model registry