0
0
MLOpsdevops~5 mins

Organizing experiments with tags and notes in MLOps - Commands & Configuration

Choose your learning style9 modes available
Introduction
When you run many machine learning experiments, it can be hard to remember what each one did. Tags and notes help you label and describe experiments so you can find and compare them easily later.
When you want to quickly find experiments that used a specific dataset or model type.
When you want to add a short description to explain what changed in an experiment.
When you want to group experiments by project phase, like 'baseline' or 'tuning'.
When you want to share experiment details with teammates clearly.
When you want to track which experiments gave the best results for a metric.
Commands
This command runs an MLflow project in the current directory with a parameter alpha set to 0.5. It starts a new experiment run.
Terminal
mlflow run . -P alpha=0.5
Expected OutputExpected
2024/06/01 12:00:00 INFO mlflow.projects: === Run (ID 123abc) started === 2024/06/01 12:00:05 INFO mlflow.projects: === Run (ID 123abc) succeeded ===
-P - Set a parameter value for the run
This runs the project with the same parameter but adds an experiment name, a run name, and tags to organize the run.
Terminal
mlflow run . -P alpha=0.5 --experiment-name 'my-experiment' --run-name 'alpha-0.5-run' --tags phase=baseline,model=linear
Expected OutputExpected
2024/06/01 12:05:00 INFO mlflow.projects: === Run (ID 456def) started === 2024/06/01 12:05:10 INFO mlflow.projects: === Run (ID 456def) succeeded ===
--experiment-name - Assign the run to a named experiment
--run-name - Give a friendly name to the run
--tags - Add key-value tags to the run for organization
Starts the MLflow tracking UI so you can see your experiments, runs, tags, and notes in a web browser.
Terminal
mlflow ui
Expected OutputExpected
2024/06/01 12:10:00 INFO mlflow.server: Starting MLflow UI at http://127.0.0.1:5000
Adds a note or description to the run with ID 456def to explain what this run tested.
Terminal
mlflow runs update --run-id 456def --description 'Tuned alpha to 0.5 for baseline linear model'
Expected OutputExpected
Run 456def updated successfully
Key Concept

If you remember nothing else from this pattern, remember: tags and notes let you label and describe experiments so you can find and understand them later.

Code Example
MLOps
import mlflow

with mlflow.start_run(run_name='alpha-0.5-run', tags={'phase': 'baseline', 'model': 'linear'}):
    mlflow.log_param('alpha', 0.5)
    mlflow.log_metric('accuracy', 0.82)
    mlflow.set_tag('dataset', 'census')
    mlflow.set_tag('note', 'Tuned alpha to 0.5 for baseline linear model')

print('Experiment run logged with tags and notes')
OutputSuccess
Common Mistakes
Not using tags or notes when running experiments
Without tags or notes, it becomes hard to remember what each experiment did or to find specific runs later.
Always add meaningful tags and notes when you start or update an experiment run.
Using unclear or inconsistent tag names
Inconsistent tags make it difficult to group or filter experiments effectively.
Use clear, consistent tag keys and values that everyone on your team understands.
Summary
Run experiments with mlflow run and add tags to label important details.
Use mlflow runs update to add notes or descriptions to explain your runs.
Start mlflow ui to view and filter experiments by tags and notes in a browser.