peal.entrypoints.run_component_analysis

Visualise every component of a sparse dictionary fitted on a generator.

Drives DiffusionAutoencoder.explain_all_components in peal/generators/diffusion_autoencoder.py. The generator is loaded from its config, the sparse dictionary (SAE, MSAE, SVD, …) is loaded from its run directory or fitted when no weights exist, and every component in [comp_min, comp_max) is swept over the validation split with a line search through the decoder.

Invocation:

python run_component_analysis.py --config <generator.yaml> \
    [--sd_config <sparse_dictionary.yaml>] [--is_loaded true]

--sd_config replaces the generator’s sparse_dictionary block and, when the dictionary config names a data config, the generator’s data config as well. --is_loaded is parsed with type=bool, so any non-empty string, including "false", is True.

Writes under <generator base_path>/<dictionary name>/: c_min_and_maxes.txt, correlations.png (component vs. ground-truth attribute correlations), samples.png when a latent DDPM exists, and the per-component *_linearsearch.png grids and contrastive collages.

Functions

main

Load the generator (and dictionary) configs and explain all components.