Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Composite Sampler #250

wants to merge 3 commits into from

Conversation

abhash-er
Copy link
Collaborator

@abhash-er abhash-er commented Apr 28, 2025

This PR adds-

  1. CompositeSampler - Sampler from a mixture of sub-sampler (in an order)
  2. CompositeProfile - Takes in a list of SamplerTypes and corresponding configs for sampling.

@abhash-er abhash-er requested a review from Neonkraft April 28, 2025 17:29
self.arch_parameters = arch_parameters

# get sample frequency from the samplers
self.sample_frequency = arch_samplers[0].sample_frequency
Copy link
Contributor

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"
Copy link
Contributor

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):
Copy link
Contributor

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:
Copy link
Contributor

@Neonkraft Neonkraft May 5, 2025

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():
Copy link
Contributor

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.

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.

2 participants