Skip to content

Update codec validation plots - #64

Open
RobbeBohy wants to merge 6 commits into
molmod:mainfrom
RobbeBohy:fix/codec-validation
Open

Update codec validation plots#64
RobbeBohy wants to merge 6 commits into
molmod:mainfrom
RobbeBohy:fix/codec-validation

Conversation

@RobbeBohy

Copy link
Copy Markdown
Collaborator

In this PR, the top panels have been removed from the codec validation plot, as they did not provide substantial additional insight.

Furthermore, the RMSE calculation has been revised. Instead of pooling all 256 * 64 samples into a single RMSE estimate, RMSEs are now computed by pooling over the 256 sequences for each seed separately and repeating this across 64 seeds. The final reported RMSE values are then obtained by averaging over these 64 repetitions. This approach more closely reflects the intended use of ACID.

Note that the equations in validation.typ have not yet been updated to reflect these changes. This will be addressed in a large upcoming documentation PR.

@RobbeBohy
RobbeBohy requested a review from tovrstra July 27, 2026 15:44

@tovrstra tovrstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments regarding one technicality to make it easier to understand the code.

The general idea of simplifying the plot is a good one. The change in RMSE calculation (between one overall RMSE or an RMSE of subsets averaged over seeds) should be small, but it conceptually aligns better with how the rest of the dataset works, which is good too.

Comment thread 3_validation/scripts/plot.py Outdated
rmse_ref_per_resolution = data["rmse_ref_per_resolution"].item()
rmse_raw_per_resolution = data["rmse_raw_per_resolution"].item()
rmse_raw_per_seed = data["rmse_raw_per_seed"]
rmse_codec_per_seed = data["rmse_codec_per_seed"].item()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to tackle this differently. I had to add some debug lines to understand why the .item() was needed.

It would be good to rule out pickling when saving NPZ files. With pickle, about anything can be stored in an NPZ file, making it also harder to understand what is being stored. I'll add a second comment with some more direction, but I'd generally recommend allow_pickle=False for all savez() calls in this repository, just to enforce simpler NPZ files. See https://numpy.org/doc/stable/reference/generated/numpy.savez.html

Comment thread 3_validation/scripts/check_codec.py Outdated
rmse_raw_per_resolution[resolution] = np.sqrt(np.mean((psd_coded - psd_raw) ** 2))
codecs = {resolution: generate_codec(resolution) for resolution in RESOLUTIONS}
rmse_raw_per_seed = np.zeros(NSEED)
rmse_codec_per_seed = {resolution: np.zeros(NSEED) for resolution in RESOLUTIONS}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the follow-up on the pickle comment. Because this line creates a dictionary, savez will pickle it as a singleton array containing a dictionary, which is a bit odd. There are other reasons to avoid pickle (very complicated format, overkill for this project, complexity in terms of understanding how it works, ...)

Practically, this can be done as follows:

  • Turn rmse_codec_per_seed into an array, of which the rows correspond to different resolutions.
  • Store the RESOLUTIONS array into the NPZ, so follow-up scripts can use them.
    This essentially splits the dictionary keys and values into two corresponding arrays, which can be stored in an NPZ without pickling.

@RobbeBohy

Copy link
Copy Markdown
Collaborator Author

Thanks for the feedback! I did an additional refactor to remove all pickled files in the other validations as well.

@RobbeBohy
RobbeBohy requested a review from tovrstra July 31, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants