Repository navigation
datagen: one sample grid and one stream seed for every generator - #255
Merged
Merged
Conversation
The samples of TimeSeriesDescription and of aqpbm-usecase's synthetic series should sit on the left-open grid (start, start + duration], and both should seed per-series streams through series_stream_seed. The two helpers are todo!() stubs here; the next commit implements them. Updates the grid expectations of existing tests (95 ms at 10 ms is now 9 samples) and records the new uc1 sample-stream hash.
TimeSeriesDescription now samples at start + k * interval for k >= 1 and k * interval <= duration, the left-open grid (start, start + duration] that evaluations use, and refuses a duration below one interval. sample_offsets_ms and series_stream_seed are public, and aqpbm-usecase's synthetic path draws through them instead of its own grid and mixed_seed.
zzylol
marked this pull request as ready for review
November 16, 2026 22:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aqpbm-usecaseandaqpbm-datagen'sTimeSeriesDescriptiongenerate different samples from the same kind of description. With a 10 s interval over 60 s,TimeSeriesDescriptionsamples at 0, 10, …, 50 s, so in left-open evaluation windows(t − 10 s, t]at t = 10, …, 60 s the sample at 0 falls in no window and the window ending at 60 s is empty: 5 of 6 samples are counted. The use-case path samples at 10, …, 60 s, and the two paths seed their per-series streams differently.(start, start + duration](sample_offsets_ms), and one per-series stream seed,splitmix64(seed ^ splitmix64(stream))(series_stream_seed), both public inaqpbm-datagen.aqpbm-usecasedraws its synthetic series through them and keeps its own label templates and phases on top.Normal(0.45, 0.08)with seed 22 and aTimeSeriesDescriptionwith one label of cardinality 3,seed: 0and the same distribution now give the same timestamps and bit-identical values per series index. Every synthetic use-case output changes (table below).Closes #250.
Review guide
main(datagen: labelled time-series API for library use; drop the ERP export #249 is merged). Two commits:213a13eadds the failing tests (the two helpers aretodo!()stubs there),adc863eis the implementation.aqpbm-datagen/src/timeseries.rs(sample_offsets_ms,series_stream_seed,validate,samples_per_series, the iterator's timestamp), thenaqpbm-usecase/src/data.rs(mixed_seeddeleted; the no-rate branch ofoffsets).aqpbm-usecase/tests/uc1.rs, and the use-case output changes below.docs/aqpbm-datagen.md.Behavior: before → after
The use-case spec with
"count": 3,"sample_interval_ms": 500,"duration_ms": 5000and the same baseline distribution:TimeSeriesDescriptionseries 0 timestampsstart + 0,+500, …,+4500(10 samples)start + 500, …,+5000(10 samples)start + 500, …,+5000seed ^ stream · 0x9E37…(use case) vssplitmix64(seed ^ splitmix64(stream))series_stream_seed(22, 0)duration_ms9 atsample_interval_ms10start_msErr:duration_ms (9) is shorter than one sample_interval_ms (10), so no sample fitsThis serves comparisons between engines: they are only comparable on identical data, and the harness evaluates over left-open windows.
Interfaces
aqpbm-datagen/src/timeseries.rs,aqpbm-datagen/src/lib.rsaqpbm-usecase/src/data.rs: private only.mixed_seedis deleted; replaced byseries_stream_seed.Usage (from
aqpbm-usecase/tests/datagen_conventions.rs):Algorithm changes
None in the sense of search or cost. The sample grid and the seed mix change as described above; rate phases keep their own offsets, which already start after the window start.
Use-case outputs that change
Every synthetic spec, digested with
aqpbm_usecase::data::generatebefore (7bb6af2) and after (adc863e). FNV-1a over timestamps and over value bits._realspecs read imported tables and do not change.uc1_syn_flood0x0ab5_805d_18d8_d702→0xd704_cd23_c966_dead)uc2_autoscalinguc3_videouc4_canaryrequestssplits samples by the drawncode)uc5_top_clientsclient_id)The use-case grid was already
(start, start + duration], so no use-case timestamp moves except throughlabel_from_valuesplits. The phase 2 and phase 3 results recorded underdocs/were measured on the old samples and are stale until rerun; they are not regenerated here.Decisions and open questions
start_ms, so samples fill(start, start + duration], matching left-open evaluation windows (rejected: keepTimeSeriesDescription's[start, start + duration)and move every evaluation time one interval earlier). The stream seed isTimeSeriesDescription's splitmix mix;mixed_seedis deleted (rejected: keep the linear mix, which gives(seed 0, stream 1)and(seed 0x9E37_79B9_7F4A_7C15, stream 0)the same seed).Verification
cargo test -p aqpbm-datagencargo test -p aqpbm-datagen --all-featurescargo test -p aqpbm-usecasecargo fmt --all --checkcargo clippy -p aqpbm-datagen -p aqpbm-usecase --all-targets --all-features -- -D warningsNew tests:
sample_offsets_are_one_interval_apart_and_end_at_the_duration: 10 s over 60 s gives 10 … 60 s.a_duration_that_is_not_a_multiple_of_the_interval_stops_at_the_last_whole_interval: (7, 100) gives 14 offsets ending at 98; (10, 101) gives 10 ending at 100.a_duration_shorter_than_one_interval_is_refused_by_name: (1000, 1) and (10, 9) are refused, naming both fields.time_series_samples_sit_on_the_left_open_grid: 50 series, 6 samples each at start + 10 s … start + 60 s.every_sample_falls_in_exactly_one_left_open_window: each window(t − 10 s, t]holds exactly one sample of each series.series_stream_seed_is_the_splitmix_mix_and_has_no_linear_collision: pins the mix and the collision the old use-case seed had.usecase_and_time_series_description_draw_the_same_samples: the example above.a_usecase_series_draws_from_the_shared_stream_seed: series 0's first value is the first draw fromseries_stream_seed(22, 0).the_use_case_1_spec_draws_a_fixed_sample_stream(renamed): still 11,340,033 samples, new hash.Updated:
every_series_is_distinct_and_sampled_on_the_intervalandno_labels_means_one_series(95 ms at 10 ms is now 9 samples at 1010 … 1090, not 10 at 1000 … 1090), andbad_descriptions_are_refused_by_name(adds the short-duration case).Failing output at the tests commit
213a13e:Not run:
aqpbm-planevalandaqpbm-systemeval. They callaqpbm_usecase::data::generateand compare exact against planned answers on the same data, so they see the new samples but have no golden values.Follow-ups
seedequal to a distribution's seed (pre-existing; not changed here).docs/are stale until the use cases are rerun.imported) keeps its own timestamps, out of scope per aqpbm-usecase: draw synthetic series from aqpbm-datagen's TimeSeriesDescription conventions #250.