-
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?
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.
yes, we never change it to epoch in our experiments, but we have option to do that. I'm not sure how handy this can come later, but I think it doesn't hurt to leave it there
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
?
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.
I was in 2 minds with it as well, but for me, functionality wise- I don't see it as a child of BaseSampler, since it takes a list of BaseSampler within its initialisation which i thought is a special case. So I thought a OneShotComponent is a better option for it. Let me know your opinion about it.
|
||
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.
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.
I think with python versions 3.7 and above, the insertion order is preserved
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.