Skip to main content

MLflow Tracking: Experiments, Runs, Parameters, and Metrics

Updated 2 min readMarkdown
Part of seriesMLOPS
MLflow Tracking: Experiments, Runs, Parameters, and Metrics

Training a model produces more than a model file. It also produces configuration choices, evaluation metrics, and artifacts. MLflow Tracking provides a structured place to record these details.

The hierarchy

An experiment groups related runs. A run represents one execution of a workflow.

For example:

fraud-detection
├── run-001
├── run-002
└── run-003

Each run can record:

  • Parameters: values chosen before or during execution, such as max_depth.
  • Metrics: numerical results, such as F1 score or accuracy.
  • Artifacts: files such as plots, reports, and model files.
  • Tags: descriptive metadata about the run.

Basic tracking code

import mlflow

mlflow.set_tracking_uri("http://localhost:5000")
mlflow.set_experiment("fraud-detection")

with mlflow.start_run(run_name="baseline"):
    mlflow.log_param("max_depth", 5)
    mlflow.log_param("n_estimators", 100)

    mlflow.log_metric("accuracy", 0.91)
    mlflow.log_metric("f1_score", 0.86)

set_tracking_uri() tells the client where the tracking server is. set_experiment() selects or creates an experiment. start_run() creates a run, and the logging functions record information against it.

Parameters versus metrics

A useful distinction:

  • A parameter describes what you configured.
  • A metric describes what happened.

For example, max_depth=5 is a parameter. f1_score=0.86 is a metric.

Why track runs?

Without tracking, experiment results may live in terminal output, notebooks, or personal notes. MLflow makes runs searchable and comparable through its UI.

Takeaway: treat each meaningful training execution as a run, and record enough information to understand and compare it later.

No comments yet. Be the first to comment.