Phase 2: Tracking
Phase 2: Experiment & Data Tracking
In this phase, we learn how to record every aspect of an ML run so it can be audited and reproduced.
🟢 Level 1: MLflow Tracking
MLflow is the industry standard for experiment management.
1. The Metadata Store
- Parameters: Hyperparameters (Learning rate, Batch size).
- Metrics: Evaluation numbers (Accuracy, F1, Loss).
- Artifacts: The saved model file (.pkl, .h5), plots, and log files.
import mlflow
with mlflow.start_run():
mlflow.log_param("optimizer", "adam")
mlflow.log_metric("val_acc", 0.94)
mlflow.log_artifact("plots/confusion_matrix.png")🟡 Level 2: DVC (Data Version Control)
Git cannot handle 100GB datasets. DVC handles this by versioning the “Pointer” to the data.
2. The DVC Workflow
dvc add data.csv-> Createsdata.csv.dvc.git add data.csv.dvc .gitignore-> Commit the pointer to Git.dvc push-> Upload raw data to S3/GCS.dvc pull-> Other developers download the exact version of the data.
🔴 Level 3: Experiment Pipelines
Instead of one giant script, break training into Steps: Download Data -> Preprocess -> Train -> Evaluate.
3. DVC DAGs
DVC can track the dependencies between steps. If the “Train” code hasn’t changed but the “Data” has, DVC knows to re-run the pipeline.