0Pricing
MLOps Academy · Lesson

Parameterize Runs with params.yaml

Sweep hyperparameters without editing code.

Parameterize Runs with params.yaml is a free MLOps Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the MLOps Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Stop Editing Code to Tune

Changing a learning rate by editing train.py is messy and hard to track. DVC reads settings from a file called params.yaml instead. 🎛️

What params.yaml Holds

The params.yaml file is plain YAML holding your hyperparameters, grouped by stage. It becomes the single place to change run settings.

train:
  learning_rate: 0.01
  epochs: 20
prep:
  test_size: 0.2

Declare Params in a Stage

Tell a stage which params it uses with the -p flag. DVC then watches those values for changes, just like file dependencies.

dvc stage add -n train \
  -p train.learning_rate,train.epochs \
  -d data/prepared python train.py

Read Params in Python

In your script, load the YAML and pull the values you need. The code stays generic while the numbers live in params.yaml.

import yaml
p = yaml.safe_load(open("params.yaml"))
lr = p["train"]["learning_rate"]

Change a Value, Re-Run

Edit a param and run dvc repro. DVC sees the value changed and re-runs only the stages that declared that param.

Override Params from the CLI

You can override a value for one run without editing the file using dvc exp run --set-param. Great for quick what-if checks.

dvc exp run --set-param train.epochs=50

Sweep with Experiments

DVC experiments let you queue many param combinations at once, so you can sweep a grid of values without touching code.

dvc exp run --set-param train.learning_rate=0.001
dvc exp run --set-param train.learning_rate=0.1

Compare Runs in a Table

Run dvc exp show to see every experiment's params and metrics side by side. Spotting the best combination becomes a glance.

dvc exp show

Pair Params with Metrics

Declare your output scores as metrics so DVC links each param set to its result. Tuning then becomes a clear cause-and-effect.

Params Live in Git Too

Because params.yaml is text, every tuning change is captured in Git history. You always know which settings produced which model.

Reproducible Sweeps

With params in a file and outputs as metrics, anyone can rerun your exact sweep and get the same numbers. That is real reproducibility.

Quick Check

Recall how params drive re-runs.

Recap: Parameterized Runs

You moved settings into params.yaml, declared them per stage, and swept values with experiments. Tuning is now code-free and reproducible. 🧪

Frequently asked questions

Is the “Parameterize Runs with params.yaml” lesson free?

Yes — the full text of “Parameterize Runs with params.yaml” is free to read here on the web, and the MLOps Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the MLOps Academy course, upgrade to CoddyKit PRO.

What will I learn in “Parameterize Runs with params.yaml”?

Sweep hyperparameters without editing code. You practise MLOps Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start MLOps Academy?

No prior experience is required. MLOps Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Parameterize Runs with params.yaml” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this MLOps Academy lesson?

Yes. Every MLOps Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Stages: Ingest, Prep, Train, Eval
  2. Define a Pipeline with DVC Stages
  3. Cache and Skip Unchanged Steps
  4. Parameterize Runs with params.yaml
← Back to MLOps Academy