Skip to content

Clamp num_marginals to the available workload size#103

Open
vvv214 wants to merge 3 commits intoryan112358:masterfrom
vvv214:codex/clamp-num-marginals
Open

Clamp num_marginals to the available workload size#103
vvv214 wants to merge 3 commits intoryan112358:masterfrom
vvv214:codex/clamp-num-marginals

Conversation

@vvv214
Copy link

@vvv214 vvv214 commented Mar 19, 2026

Summary

  • avoid np.random.choice(..., replace=False) failures when --num_marginals exceeds the filtered workload size
  • keep the existing random subsampling behavior unchanged when enough candidates are available
  • add the bound check directly in the mechanism entrypoints that materialize the filtered workload

Why

After filtering by degree and max_cells, the CLI scripts do not currently validate --num_marginals against the number of remaining candidates. There is not an earlier shared validation point before these filtered workloads are materialized, so requesting more marginals than remain raises a ValueError from choice(..., replace=False).

Testing

  • ~/.local/bin/uv run --extra dev pytest -q

@google-cla
Copy link

google-cla bot commented Mar 19, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant