Query, don't scroll
Runs are queryable data
Every run is a row you can query with mlflow.search_runs, which returns a pandas DataFrame. This turns 'which config won?' from UI scrolling into one expression:
import mlflow
df = mlflow.search_runs(
experiment_names=['credit-scoring'],
filter_string="metrics.roc_auc > 0.9 and params.model = 'xgboost'",
order_by=['metrics.roc_auc DESC'],
max_results=10,
)
best_run_id = df.iloc[0]['run_id']
Nested runs keep sweeps tidy
A hyperparameter sweep should be one parent run with a child run per trial, so the experiment list isn't flooded:
with mlflow.start_run(run_name='sweep') as parent:
for lr in [0.01, 0.1, 0.3]:
with mlflow.start_run(nested=True, run_name=f'lr={lr}'):
mlflow.log_param('lr', lr)
mlflow.log_metric('roc_auc', train(lr))
The parent groups the trials; search_runs can still reach every child for the comparison.