Skip to content

Adapter scale and shift #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 8, 2025
Merged

Adapter scale and shift #394

merged 6 commits into from
Apr 8, 2025

Conversation

LarsKue
Copy link
Contributor

@LarsKue LarsKue commented Apr 8, 2025

Addresses #353

@LarsKue LarsKue added feature New feature or request user interface Changes to the user interface and improvements in usability good first issue Good for first-time contributors sugar Syntactical sugar or quality of life improvements labels Apr 8, 2025
@LarsKue LarsKue added this to the BayesFlow 2.0 milestone Apr 8, 2025
@LarsKue LarsKue requested a review from Copilot April 8, 2025 15:37
@LarsKue LarsKue self-assigned this Apr 8, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 35 out of 35 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

bayesflow/approximators/model_comparison_approximator.py:256

  • The tuple unpacking of the classifier_network may lead to issues if the deserialize function does not return an iterable. Consider assigning the output directly and verifying its format.
(config["classifier_network"],) = deserialize(config["classifier_network"], custom_objects=custom_objects)

def scale(self, keys: str | Sequence[str], by: float | np.ndarray):
from .transforms import Scale

self.transforms.append(MapTransform({key: Scale(scale=by) for key in keys}))
Copy link
Preview

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

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

MapTransform is referenced but not imported. Please add an import statement for MapTransform to ensure it is defined.

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

@LarsKue LarsKue changed the base branch from main to dev April 8, 2025 15:38
@LarsKue LarsKue requested a review from Copilot April 8, 2025 15:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

tests/test_adapters/conftest.py:23

  • [nitpick] The key 'x' used for scaling and shifting might be ambiguous; consider using a more descriptive name to improve code clarity.
.scale("x", by=[-1, 2])

bayesflow/adapters/adapter.py:559

  • [nitpick] Consider moving the import statements out of the function bodies to the top of the module for consistency and potential performance improvements.
from .transforms import Scale

@LarsKue LarsKue requested a review from paul-buerkner April 8, 2025 15:45
Copy link

codecov bot commented Apr 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
bayesflow/adapters/adapter.py 82.65% <100.00%> (+1.29%) ⬆️
bayesflow/adapters/transforms/__init__.py 100.00% <100.00%> (ø)
bayesflow/adapters/transforms/scale.py 100.00% <100.00%> (ø)
bayesflow/adapters/transforms/shift.py 100.00% <100.00%> (ø)

@LarsKue LarsKue merged commit 512b323 into dev Apr 8, 2025
15 checks passed
@LarsKue LarsKue deleted the adapter-scale-and-shift branch April 8, 2025 17:57
@github-project-automation github-project-automation bot moved this from Future to Done in bayesflow development Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for first-time contributors sugar Syntactical sugar or quality of life improvements user interface Changes to the user interface and improvements in usability
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant