-
Notifications
You must be signed in to change notification settings - Fork 0
Composite Sampler #250
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
base: main
Are you sure you want to change the base?
Composite Sampler #250
Conversation
integrate composite sampler to confopt
self.arch_parameters = arch_parameters | ||
|
||
# get sample frequency from the samplers | ||
self.sample_frequency = arch_samplers[0].sample_frequency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still use sampling frequency in the code?
for sampler in arch_samplers: | ||
assert ( | ||
self.sample_frequency == sampler.sample_frequency | ||
), "All the sampler must have the same sample frequency" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"All samplers must have"
from confopt.oneshot.base import OneShotComponent | ||
|
||
|
||
class CompositeSampler(OneShotComponent): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why inherit from OneShotComponent
? Why not inherit from BaseSampler
?
**kwargs, | ||
) | ||
|
||
def _initialize_sampler_config(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function is defined but never consumed.
EDIT: I see it's called in the base class
|
||
if sampler == SamplerType.COMPOSITE: | ||
sub_samplers: list[BaseSampler] = [] | ||
for _, sampler_config in config.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, config.items()
might not return the values in a specific order. This might mean that multiple instantiations of the CompositeSampler
with the same samplers might have the samplers in different order.
This PR adds-
CompositeSampler
- Sampler from a mixture of sub-sampler (in an order)CompositeProfile
- Takes in a list of SamplerTypes and corresponding configs for sampling.