Skip to content

Metasampler, MultiBatchSampler, SamplerControler #15

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

Merged
merged 4 commits into from
May 25, 2022
Merged

Conversation

HenriDeh
Copy link
Member

Hello,

Following the discussion in #13, I made this PR to add 3 things

  • MetaSampler: a wrapper for a namedtuple of samplers. This allows to combine multiple samplers when needed in algorithm design. It returns a named tuple with the same keys as the wrapped one, and its values are sampled batches.
  • MultiBatchSampler: a wrapper for a sampler that, when sampled, will sample n times instead of once. It thus returns a collection of n batches. This allows to combine samplers in a metasampler that are not meant to be sampled the same number of time.
  • InsertSampleController: it's an alternative to the ratio controller that will stop after a fixed number of samples. I first tried to implement the nothing controller you proposed in How do we deal with metasampler ? #13 but this lead to infinite sampling because the loop has no end condition.
  • I also fixed the spelling of controller (it has two L's apparently, full disclosure I just discovered that while writing this).

This should be enough to close #13 and will allow to easily refactor old algorithms using Trajectories.jl.

@codecov-commenter
Copy link

Codecov Report

Merging #15 (efffb6a) into main (c2db98d) will increase coverage by 3.37%.
The diff coverage is 97.77%.

@@            Coverage Diff             @@
##             main      #15      +/-   ##
==========================================
+ Coverage   30.06%   33.43%   +3.37%     
==========================================
  Files           9        9              
  Lines         316      332      +16     
==========================================
+ Hits           95      111      +16     
  Misses        221      221              
Impacted Files Coverage Δ
src/rendering.jl 0.00% <ø> (ø)
src/trajectory.jl 91.66% <93.75%> (ø)
src/controllers.jl 100.00% <100.00%> (ø)
src/samplers.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2db98d...efffb6a. Read the comment docs.

Copy link
Member

@findmyway findmyway left a comment

Choose a reason for hiding this comment

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

LGTM

@HenriDeh HenriDeh merged commit ffc8576 into main May 25, 2022
@HenriDeh HenriDeh deleted the metasampler branch May 25, 2022 09:00
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.

How do we deal with metasampler ?
3 participants