StatsBase.sample should warn about weights containing Inf/NaN
https://github.com/JuliaStats/StatsBase.jl/blob/08d4b77a4b42ef8cadb67b98da65e7fbd9959e0b/src/sampling.jl#L499-L500 Perhaps add something like
swv = sum(wv)
isfinite(swv) || throw(DomainError(swv, "weights sum to $swv"))
Good idea. Would you make a pull request?
I recently ran into a bug due to this issue. A warning about Inf weights would have helped me to find the problem faster. I see the PR wasn't accepted though. Are there still plans to implement this?
Actually the PR wasn't rejected, it was closed by its author (I don't know why). Would you be willing to make a new PR with its contents?
Actually the PR wasn't rejected, it was closed by its author (I don't know why). Would you be willing to make a new PR with its contents?
#814