Skip to content

Conversation

@vpratz
Copy link
Collaborator

@vpratz vpratz commented Apr 16, 2025

Concerns #417.
Question:
As Lars already highlighted when creating the current implementation, we cannot pass the stage to the __getitem__ methods of the datasets. How do we want to handle this?
For now, I have made the stage that will be used configurable in the __init__ function.
What should its default be? For now, I have set it to "training". The alternative would be to set it to "inference" and dynamically change it to "training" in Approximator.fit.
What do you think, @LarsKue and @stefanradev93? Setting this to a draft until we have discussed this...

Minor point: Do we want to convert the stages to an enum. This would be a bit more typing (but autocomplete should help), and might prevent future bugs due to typos in the strings. Not sure whether it is worth it though, what do you think?

- In addition, make the stage used in the datasets configurable with a parameter.
  Defaults to "training" for now.
@vpratz vpratz requested review from LarsKue and stefanradev93 April 16, 2025 15:45
@codecov
Copy link

codecov bot commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bayesflow/datasets/disk_dataset.py 0.00% 2 Missing ⚠️
bayesflow/datasets/rounds_dataset.py 0.00% 2 Missing ⚠️
Files with missing lines Coverage Δ
bayesflow/adapters/adapter.py 81.05% <100.00%> (ø)
bayesflow/adapters/transforms/standardize.py 97.43% <100.00%> (ø)
bayesflow/datasets/offline_dataset.py 92.85% <100.00%> (+0.17%) ⬆️
bayesflow/datasets/online_dataset.py 100.00% <100.00%> (ø)
bayesflow/datasets/disk_dataset.py 38.23% <0.00%> (-1.16%) ⬇️
bayesflow/datasets/rounds_dataset.py 36.36% <0.00%> (-1.14%) ⬇️

@LarsKue
Copy link
Contributor

LarsKue commented Apr 17, 2025

Datasets will pretty much only ever be used directly in training. I am fine with this change, although I do wish we had a better alternative available (such as simply not requiring a stage argument for the Adapter, since it should not be trainable in the first place).

Copy link
Contributor

@LarsKue LarsKue left a comment

Choose a reason for hiding this comment

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

I don't think we should change the stage argument to an enum, because either users will then have to make another import (cumbersome), or we make it compatible with strings anyway, in which case this becomes the primary use case.

@stefanradev93
Copy link
Contributor

I suggest we stick to the simplest solution as proposed by Valentin.

@stefanradev93 stefanradev93 marked this pull request as ready for review April 17, 2025 20:43
@stefanradev93 stefanradev93 merged commit fc45f83 into bayesflow-org:dev Apr 17, 2025
15 checks passed
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.

3 participants