Experiment Tracking
"Last Tuesday I got recall 0.78, but I can't remember which settings I used." Every data scientist has said a version of this. Training is a search: dozens of runs with different features, depths and learning rates. Without a record, the best result of the week can be lost by Friday.
The rule
Log what you set, what you got, what you made, and where it came from.
An experiment tracker stores one record per training run. MLflow is the most common open-source one:
import mlflow
mlflow.set_experiment("churn")
with mlflow.start_run(run_name="depth-6-with-playlists"):
mlflow.log_params({"max_depth": 6, "learning_rate": 0.1}) # what you set
mlflow.set_tag("data_version", "v2026-06") # where it came from
model = train(features, max_depth=6, learning_rate=0.1)
mlflow.log_metric("recall", 0.74) # what you got
mlflow.log_metric("precision", 0.66)
mlflow.sklearn.log_model(model, "model") # what you made
mlflow.log_artifact("confusion.png")The four parts of the rule map to four kinds of record:
- Parameters — settings you chose:
max_depth,learning_rate, the cutoff date. - Metrics — numbers you measured: recall, precision, training time. Metrics can also be logged per step, to draw learning curves.
- Artifacts — files the run produced: the model itself, plots, a sample of predictions.
- Source — the code and data versions. When the script runs from a Git repository, MLflow records the commit automatically; the DVC data version you add as a tag.
mlflow ui opens a web page where runs sit in a table you can sort, filter and compare side by side. For common libraries, mlflow.sklearn.autolog() logs parameters, metrics and the model with one line.