experiment_runner.defaults

Where the runner’s default settings come from.

The package’s own function signatures are the single source of truth for every default a component consumes. This module records which signature owns which config key and reads the value off it, so a renamed or removed parameter fails here at startup instead of leaving a stale literal behind. master.yaml documents the same values for people writing configs, and a test holds the two in step.

Keys the package knows nothing about - the runner’s own control flow, and the Quantus parameter blocks - are listed in _RUNNER_OWNED instead, where master.yaml stays authoritative. Between them the two tables must cover every key in every default_settings block; a test enforces that, so a new key has to be classified rather than quietly joining neither group.

Attributes

logger

Functions

package_default(→ object)

Read one package-backed default off the signature that owns it.

hyperparam_names(→ frozenset[str])

Return the training hyperparameters a model entry may set.

apply_package_defaults(→ None)

Replace master's copy of every package-backed default with the derived one.

default_settings_leaves(→ list[str])

List the (possibly dotted) keys of one default_settings block.

Module Contents

experiment_runner.defaults.logger
experiment_runner.defaults.package_default(section: str, key: str) → object

Read one package-backed default off the signature that owns it.

Parameters:
  • section (str) – Config section, e.g. "data_config".

  • key (str) – Key within that section’s default_settings, dotted for a nested one (e.g. "hyperparams.epochs").

Returns:

The owning parameter’s default. A tuple default is returned as a list, so the value stays plain YAML rather than reaching the resolved config and the run log as a Python tuple.

Return type:

object

Raises:

KeyError – If the key is not package-backed, or if the owning callable no longer has that parameter - which is the point of the table: a rename fails loudly here rather than leaving the runner on a stale literal.

experiment_runner.defaults.hyperparam_names() → frozenset[str]

Return the training hyperparameters a model entry may set.

Derived from both pointer tables rather than listed again, so adding a hyperparameter to train_model() and the table is enough to make it configurable.

Both tables, not just the package-backed one: loss_func and optimizer name library objects the runner builds, and loss_params / optimizer_params are consumed by the runner and never reach train_model at all. Deriving from _PACKAGE_BACKED alone would make all four “not a training parameter” in config validation.

Returns:

The accepted key names inside a hyperparams block.

Return type:

frozenset[str]

experiment_runner.defaults.apply_package_defaults(user_config: dict, resolved: dict) → None

Replace master’s copy of every package-backed default with the derived one.

Modifies resolved in place. A key the user states in their own default_settings is left alone, so user settings still win; for every other key master’s value is overwritten by the package’s, which is what makes master documentation rather than a second authority. The two agree by test, so this changes no value - it removes the possibility of them disagreeing.

Parameters:
  • user_config (dict) – The raw user config, consulted only to see which keys the user stated.

  • resolved (dict) – The config after master has been merged in, modified in place.

experiment_runner.defaults.default_settings_leaves(section: str, block: dict) → list[str]

List the (possibly dotted) keys of one default_settings block.

Nested mappings are descended into, so hyperparams contributes one key per hyperparameter - except where the parent itself is runner-owned, which stops the descent, since the whole subtree then belongs to master.yaml.

Parameters:
  • section (str) – Config section the block belongs to.

  • block (dict) – The default_settings mapping.

Returns:

One entry per leaf, in declaration order.

Return type:

list[str]