experiment_runner.config ======================== .. py:module:: experiment_runner.config .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: experiment_runner.config.logger Functions --------- .. autoapisummary:: experiment_runner.config.register_external_components experiment_runner.config.config_resolve experiment_runner.config.config_sanity_check Module Contents --------------- .. py:data:: logger .. py:function:: register_external_components(config: dict) -> None Load and register external model/explainer/metric classes from the config. Silent extension fallback used by :func:`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 :func:`config_sanity_check` raises a clear error. :param config: Resolved configuration dict. :type config: dict .. py:function:: 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). :param user_config: Raw config dict as loaded from the user YAML. :type user_config: dict :param master_path: Path to master.yaml. :type master_path: Path :returns: Resolved config with defaults applied and unknown keys removed. :rtype: dict .. py:function:: 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 :func:`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. :param config: Configuration to check. :type config: dict :returns: ``True`` if the configuration contains no errors. :rtype: bool