By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Version control & experiment tracking keep every piece of a machine‑learning project—code, data, model artifacts, and hyper‑parameters—reproducible and searchable. In a churn‑prediction pipeline, for example, you might iterate over dozens of feature‑engineering scripts, data snapshots, and model versions; Git, DVC, and MLflow let you snap each change, compare results, and roll back to the exact state that produced the best AUC without guessing which notebook you ran last.
.dvc
max_depth=6
dvc.yaml
dvc repro
.h5
mlflow.search_runs(filter_string="params.max_depth='6'")
bash git init dvc init git commit -m "baseline repo"
bash dvc add data/raw/churn.csv git add data/raw/churn.csv.dvc .gitignore git commit -m "track raw data"
python import mlflow, mlflow.sklearn mlflow.set_experiment("churn-prediction") with mlflow.start_run(): mlflow.log_param("model", "RandomForest") mlflow.log_param("n_estimators", 200) model.fit(X_train, y_train) preds = model.predict_proba(X_test)[:,1] mlflow.log_metric("AUC", roc_auc_score(y_test, preds)) mlflow.sklearn.log_model(model, "model")
yaml stages: train: cmd: python src/train.py deps: - src/train.py - data/processed/train.parquet outs: - models/rf.pkl - metrics/metrics.json
mlflow ui
git checkout <commit>
dvc checkout
Mistake: Committing large CSVs or model binaries directly to Git. Correction: Use DVC (or Git LFS) to store heavy files; Git should only contain lightweight code and .dvc pointers.
Mistake: Logging the same metric under different names (e.g., “accuracy” vs “acc”). Correction: Standardize metric keys across runs; MLflow UI groups runs by exact key strings, so inconsistency hides comparisons.
Mistake: Relying on a single local mlruns folder and forgetting to push it to a remote. Correction: Configure a remote backend store (SQL or S3) early; mlflow server --backend-store-uri sqlite:///mlflow.db or mlflow.set_tracking_uri("s3://my-bucket/mlflow").
mlruns
mlflow server --backend-store-uri sqlite:///mlflow.db
mlflow.set_tracking_uri("s3://my-bucket/mlflow")
Mistake: Changing data preprocessing code without updating the DVC stage dependencies. Correction: List every script, config, and data file in deps; DVC will detect changes and re‑run the stage automatically.
deps
Mistake: Assuming the latest Git commit always matches the best MLflow run. Correction: Tag the commit that produced a given run (git tag -a v1.2 -m "best AUC"), or store the Git SHA as an MLflow tag (mlflow.set_tag("git_sha", repo.head.commit.hexsha)).
git tag -a v1.2 -m "best AUC"
mlflow.set_tag("git_sha", repo.head.commit.hexsha)
.env
dvc remote modify --local myremote auth basic
MLFLOW_S3_ENDPOINT_URL
Scenario: You added a new feature engineering script but the model performance didn’t change. Answer: Check the DVC pipeline – the stage may be cached because DVC thinks inputs are unchanged. Run dvc repro -f to force re‑execution.
dvc repro -f
Scenario: Two MLflow runs have identical AUC scores, but one uses a different random seed. Answer: Log the seed as a tag (mlflow.set_tag("seed", 42)) and compare the full parameter set; reproducibility requires the seed to be part of the run metadata.
mlflow.set_tag("seed", 42)
Scenario: Your Git history is clean, but mlflow ui shows 30 runs with the same parameters. Answer: You likely logged multiple runs without committing the code changes; each run points to the same Git SHA, so differentiate runs by adding a unique identifier (e.g., timestamp) as a tag.
dvc add
mlflow.start_run()
mlflow.log_metric("loss", val, step=epoch)
dvc move
postgresql://...
.gitignore
.dvc/tmp
mlflow.search_runs(filter_string="metrics.AUC > 0.85")
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.