Skip to content

Conversation

@vpratz
Copy link
Collaborator

@vpratz vpratz commented May 20, 2025

Very basic transform, just the inverse of expand_dims.
Fixes #479.

@vpratz vpratz requested review from LarsKue and han-ol May 20, 2025 07:39
@vpratz vpratz added the feature New feature or request label May 20, 2025
Very basic transform, just the inverse of expand_dims
@vpratz vpratz force-pushed the feat-squeeze-transform branch from 33b416c to 25b73d3 Compare May 20, 2025 07:41
@codecov
Copy link

codecov bot commented May 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
bayesflow/adapters/adapter.py 84.68% <100.00%> (+0.40%) ⬆️
bayesflow/adapters/transforms/__init__.py 100.00% <100.00%> (ø)
bayesflow/adapters/transforms/squeeze.py 100.00% <100.00%> (ø)

@stefanradev93
Copy link
Contributor

Looks good! I would only change the example from:

sq = bf.adapters.transforms.Squeeze(axis=1)

to

sq = bf.adapters.transforms.Squeeze(axis=-1)

For these transforms, we should discourage the use of absolute axis when applied to inference targets, since these change dimensionality between training and inference (e.g., inference adds a sample dim and thus absolute axis index changes meaning).

@vpratz
Copy link
Collaborator Author

vpratz commented May 20, 2025

Thanks for taking a look. Good point, do we want to warn when we encounter non-negative values?

@stefanradev93
Copy link
Contributor

It may be a bit too intense, since we should ideally only warn if the variables change shape.

@vpratz vpratz merged commit 3c0bcc4 into dev May 20, 2025
8 checks passed
@vpratz vpratz deleted the feat-squeeze-transform branch May 20, 2025 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants