peal.sparse_dictionaries.utils

Plotting helpers for evaluating sparse dictionaries against known attributes.

Used by the SAE / MSAE evaluation scripts to visualise how strongly each learned component correlates with ground-truth attributes (e.g. CelebA labels) and how much variance of the underlying activations the leading components explain. The commented-out block at the end is an earlier version kept for reference.

Functions

plot_component_ground_truth_correlations

Plots a correlation heatmap (Top) and a Full Cumulative Explained Variance plot (Bottom).

read_component_bounds

Read c_min_and_maxes.txt and return (c_mins, c_maxs) for the selected columns.

select_dictionary_components

Return (W, selected): the dictionary columns the counterfactual attempts steer along.