Skip to content

More fine-grained control for custom sampling schemes#419

Merged
quaquel merged 3 commits intomasterfrom
advanced_sampling
Sep 24, 2025
Merged

More fine-grained control for custom sampling schemes#419
quaquel merged 3 commits intomasterfrom
advanced_sampling

Conversation

@quaquel
Copy link
Copy Markdown
Owner

@quaquel quaquel commented Sep 22, 2025

This adds a new combine method to the DesignIterator class that allows you to combine the results of different samplers.

API

samples1 = sample_parameters(parameters_1, 100, LHSSampler(), rng=42)
samples2 = sample_parameters(parameters_2, 10, FFSampler())

# combine both sets of samples in a full factorial manner.
combined_samples = samples1.combine(samples2, "full_factorial")

# combine both sets of samples by cycling over the shortest set until it is
# equal in length to the longest set.
combined_samples = samples1.combine(samples2, "cycle")

# combine both sets of samples by sampling with replacement from the 
# shortest set until it is equal in length to the longest set.
combined_samples = samples1.combine(samples2, "sample", rng=271828)

# we can also chain this
combined_samples = samples1.combine(samples2).combine(samples3)

@coveralls
Copy link
Copy Markdown

coveralls commented Sep 22, 2025

Coverage Status

coverage: 88.199% (+0.2%) from 88.032%
when pulling ae22c2b on advanced_sampling
into 299bfef on master.

@quaquel quaquel linked an issue Sep 22, 2025 that may be closed by this pull request
@quaquel quaquel changed the title More fine-grained control over custom sampling schemes More fine-grained control for custom sampling schemes Sep 23, 2025
@quaquel quaquel merged commit 1ef4854 into master Sep 24, 2025
22 of 24 checks passed
@quaquel quaquel deleted the advanced_sampling branch September 24, 2025 07:00
Copy link
Copy Markdown
Collaborator

@EwoutH EwoutH left a comment

Choose a reason for hiding this comment

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

Nice API!

Two small code suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom combinations of sampling schemes

3 participants