Skip to content

Add batched oracle binary dataset simulator - #514

Merged
imerad merged 3 commits into
mainfrom
feat/batched_oracle_dataset_simulator
Nov 6, 2026
Merged

imerad merged 3 commits into
mainfrom
feat/batched_oracle_dataset_simulator

Conversation

@imerad

@imerad imerad commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Adds generate_batched_binary_dataset_with_oracle_sampling, which generates a stream of binary datasets with oracle uncertainty scores, one per batch, with per-batch n_samples, true_mean, proxy_mean and correlation (e.g. to inject a drift in actively sampled data). It is exported from glide.simulators and listed in the API reference.
  • Closes Add generate_batched_binary_dataset_with_oracle_sampling simulator #508
  • Any noteworthy implementation decisions or trade-offs?

Checklist

Quality gates that must be satisfied before requesting a review:

  • I have read CONTRIBUTING.md
  • make lint passes
  • make type-check passes
  • make tests passes
  • make coverage reports 100% coverage
  • make test-notebooks passes
  • New public API has numpy-style docstrings
  • New public API is inserted in the API reference section of the documentation
  • Docs build without warnings (make doc)
  • CHANGELOG.md updated if the change is user-facing

LLM usage

Disclose if an LLM was used in writing this PR:

  • No LLM used
  • I used an LLM and I went through and validated all the code myself

🤖 Generated with Claude Code

@imerad imerad added feature New feature or request ASI Linked to active statistical inference Simulators labels Nov 5, 2026
@codecov

codecov Bot commented Nov 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@imerad

imerad commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

Code review

Six findings, none blocking.

1. Duplicated batching scaffolding (glide/simulators/batched_oracle_binary.py:77)

The per-batch loop, SeedSequence spawning, per-batch call, np.full_like batch ids and np.hstack assembly are copied from batched_stratified_binary and batched_clustered_binary, with only the inner generator swapped. This is a third copy, so a future change to batch-id dtype or seed derivation has to be made in three places and can silently diverge. It goes against the "No Redundancy" rule. A shared private helper taking the inner generator would avoid it (could also be a follow-up refactor).

2. No test for an infeasible batch (tests/unit/simulators/test_batched_oracle_binary.py)

The docstring's Raises section says a ValueError is propagated when any batch is infeasible, but no unit test asserts it (e.g. a correlation outside the feasible range for batch 1 only). The sibling batched tests cover this path.

3. SeedSequence input has no direct test (glide/simulators/oracle_binary.py:14)

random_seed was widened to accept np.random.SeedSequence, but only the batched wrapper exercises it, indirectly. A regression would only surface through the batched test's hard-coded values, not in test_oracle_binary.py.

4. Doctest is weak (glide/simulators/batched_oracle_binary.py:67)

The example only checks lengths and the number of unique batches. It never inspects y_proxy, the uncertainty output or the batch ids, so a bug applying batch 0's parameters to every batch would still pass, and it does not show the batch-wise drift the function exists for.

5. Type annotation gap (glide/simulators/batched_oracle_binary.py:15) (minor)

The batched wrapper still annotates random_seed as Optional[int], while generate_binary_dataset_with_oracle_sampling now takes Optional[Union[int, np.random.SeedSequence]]. The batched stratified and clustered wrappers have the same gap, so this is a consistency issue, not a crash.

6. API index row placement (docs/api/index.md:15) (minor)

The new row sits between the batched clustered and batched stratified entries, not next to the non-batched oracle simulator (line 11), and is not in alphabetical or logical order.

@imerad
imerad requested a review from gmartinon-ed November 5, 2026 10:09
@imerad
imerad merged commit 180b9ed into main Nov 6, 2026
6 checks passed
@imerad
imerad deleted the feat/batched_oracle_dataset_simulator branch November 6, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ASI Linked to active statistical inference feature New feature or request Simulators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add generate_batched_binary_dataset_with_oracle_sampling simulator

2 participants