One Change at a Time

Python for AIMedium+10 XP+10

One Change at a Time

You're trying out settings for a model. The starter code has train(depth, seed, rate=0.1), which just describes the run as text.

Task: write run_all(base, changes).

  • base is a dictionary of starting settings, like {"depth": 3, "seed": 0}.
  • changes is a list of dictionaries. Each one says which settings to change for one run.
  • For each change, build that run's settings: everything in base, with the change's values on top. Then call train with those settings by name.
  • Return the list of what train gave back, one per change, in order.
  • Don't change base itself — each run starts again from base.

Examples

base = {"depth": 3, "seed": 0}
changes = [{"depth": 5}, {"rate": 0.5}]
returns ['depth=5 seed=0 rate=0.1', 'depth=3 seed=0 rate=0.5']
base = {"depth": 2, "seed": 1}
changes = []
returns []

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run