Skip to content

Add array storage to ActivationTracker scalar_history #152

@adamimos

Description

@adamimos

Background

Currently ActivationTracker._scalar_history stores individual scalar values:

{
    "pca/layer_0_cumvar_1": [(step, value), ...],
    "pca/layer_0_cumvar_2": [(step, value), ...],
    ...
}

For visualization purposes (e.g., CEV over training plots), it's more convenient to store the full cumulative variance array per step rather than individual components.

Proposed Enhancement

Add a parallel _array_history storage:

{
    "pca/layer_0_cumvar": [(step, np.array([...])), ...],
}

Or extend the existing API:

tracker.log_array(key, step, array)
tracker.get_array_history(pattern) -> dict[str, list[tuple[int, np.ndarray]]]

Use Case

This would allow visualization functions to directly receive the cumulative variance curve without needing to reassemble it from individual scalar components.

Workaround

For now, we're maintaining a separate in-memory dict in the training loop:

cve_history[layer].append({"step": step, "cumvar": cumvar_array})

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions