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

wsample(w) behaves not as the documentation describes it #884

Open
cafaxo opened this issue Jul 26, 2023 · 1 comment
Open

wsample(w) behaves not as the documentation describes it #884

cafaxo opened this issue Jul 26, 2023 · 1 comment
Labels

Comments

@cafaxo
Copy link

cafaxo commented Jul 26, 2023

The doc says

wsample([rng], [a], w)

Select a weighted random sample of size 1 from a with probabilities
proportional to the weights given in w. If a is not present, select a random
weight from w.

From this, I expect wsample(w) ∈ w. However, I am getting

julia> wsample([1,10])
2
@cafaxo cafaxo changed the title wsample(w) behaves not as the docs describe it wsample(w) behaves not as the documentation describes it Jul 26, 2023
@perrette
Copy link

Just passing by: it does look that a sensibile behavior (sampling the weight indices) and a bad documentation. Definitely not a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants