experiment_runner.config

Config loading and validation for the experiment runner.

Resolves user YAML against master.yaml, applies per-method defaults, and validates model and explainer names against the live runtime registries.

Attributes

logger

Functions

register_external_components(→ None)

Load and register external model/explainer/metric classes from the config.

config_resolve(→ dict)

Resolve a user config against the master config.

config_sanity_check(→ bool)

Check whether the supplied config contains errors.

Module Contents

experiment_runner.config.logger
experiment_runner.config.register_external_components(config: dict) None

Load and register external model/explainer/metric classes from the config.

Silent extension fallback used by config_sanity_check(): when a configured component name is absent from its runtime registry but the item supplies class_name and class_path, the class is imported from that source file and registered, so the rest of the pipeline treats it like any built-in. This lets users add components without editing package source.

Gated by general.allow_external_code (default False). If a path is supplied while the flag is off, a warning is logged and the component is left unregistered, so the subsequent validation in config_sanity_check() raises a clear error.

Parameters:

config (dict) – Resolved configuration dict.

experiment_runner.config.config_resolve(user_config: dict, master_path: pathlib.Path) dict

Resolve a user config against the master config.

Steps performed:

  1. Load master.yaml (annotated reference with all known keys and defaults).

  2. Warn + drop any unknown top-level or nested keys found in user_config.

  3. Fill per-item defaults for each explainer and metric from the master’s explainers / metrics lists (user keys win, gaps filled).

Parameters:
  • user_config (dict) – Raw config dict as loaded from the user YAML.

  • master_path (Path) – Path to master.yaml.

Returns:

Resolved config with defaults applied and unknown keys removed.

Return type:

dict

experiment_runner.config.config_sanity_check(config: dict) bool

Check whether the supplied config contains errors.

First registers any external components declared via class_name / class_path (see register_external_components()), then validates models and explainers against the live runtime registries so that both custom entries added via register_model() / register_explainer() and external classes loaded from source are accepted.

Parameters:

config (dict) – Configuration to check.

Returns:

True if the configuration contains no errors.

Return type:

bool