A real ML project runs dozens or hundreds of training attempts, each with slightly different hyperparameters, and each producing metrics that evolve over time and artifacts (checkpoints, plots) worth keeping. Without a structured record of exactly what settings produced exactly what results, "which run was the good one?" becomes an unanswerable question within days. Experiment tracking is the discipline of recording every run's inputs and outputs in one consistent, queryable structure.
Implement create_run, log_metric, log_artifact, get_metric_history, and get_latest_metric, the minimal structure of a real experiment-tracking system.
create_run(run_id, hyperparameters) stores a COPY of hyperparameters (mutating the caller's dict afterward must not affect the run).log_metric(run, name, value, step) APPENDS to that metric's history: never overwrites earlier values.log_artifact(run, name, path) OVERWRITES any earlier artifact registered under the same name.get_latest_metric(run, name) returns the value at the HIGHEST logged step, not necessarily the most recently appended entry.Open one at a time. Each gives away a little more than the last.
Metrics and artifacts behave differently on purpose: a metric like "loss" is measured repeatedly over training (you want the whole history), while an artifact like "checkpoint" is a single current reference (you only ever want the latest one).
run["metrics"].setdefault(name, []).append((step, value)) handles both "first time logging this metric" and "appending to an existing history" in one line.
No results yet
Run your code to check it against the examples, or submit to run every test.