Skip to content
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

Weighted sampling #6

Open
tabatkins opened this issue Apr 23, 2024 · 0 comments
Open

Weighted sampling #6

tabatkins opened this issue Apr 23, 2024 · 0 comments

Comments

@tabatkins
Copy link
Collaborator

The Python random.choices() function defaults to selecting an item uniformly from the collection, but optionally lets you specify a list (of the same size) of weights to make a weighted sample instead. I suspect that'll be fairly useful.

(It also lets you instead specify your weights as cumulative weights; I dunno if we really need to support both. Converting one to the other is trivial.)

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

No branches or pull requests

1 participant