B1 - experiment tracking

experimentruns{parameters, metrics, artifacts}
MLflow

  • an open-source platform/tooling ecosystem for managing parts of the ML lifecycle, particularly experiment tracking and model-related workflows

parameters, metrics and artifacts

mlflow.log_metric("f1", f1)
mlflow.log_metric("recall", recall)
mlflow.log_metric("loss", 0.90, step=1)
mlflow.log_metric("loss", 0.61, step=2)
...
artifacts/
├── confusion_matrix.png
├── roc_curve.png
├── model.pkl
├── feature_importance.csv
└── evaluation_report.json
# human-readable log
print(f"F1 = {f1}")

# structured metric
mlflow.log_metric("f1", f1)
import mlflow

with mlflow.start_run():

    mlflow.log_param("max_depth", max_depth)
    mlflow.log_param("learning_rate", learning_rate)

    model.fit(X_train, y_train)

    predictions = model.predict(X_val)

    f1 = ...
    recall = ...

    mlflow.log_metric("f1", f1)
    mlflow.log_metric("recall", recall)

    mlflow.log_artifact("confusion_matrix.png")
Azure ML Job
      │
      ▼
train.py
      │
      ├── mlflow.log_param(...)
      ├── mlflow.log_metric(...)
      └── mlflow.log_artifact(...)
             │
             ▼
        MLflow tracking
             │
             ▼
      visible through Azure ML

misc

tracking URI

  • the address that tells MLflow where to log and store experimental metadata, parameters, metrics, and artifacts

autologging

mlflow.sklearn.autolog()

artifact cs MLflow model

mlflow.sklearn.log_model(...)
mlflow.log_artifact("model.pkl")

model signature

MODEL
│
├── Input schema
│   ├── temperature
│   ├── voltage
│   └── noise
│
└── Output schema
    └── failure_probability