functions that only support finite weights now throw errors for non-finites
AbstractWeights can contain any values, including NaNs – and many StatsBase functions work with them just fine. But not all, for some like sample it doesn't make sense. So, here I make these functions throw an exception instead of returning a potentially incorrect result.
Some docstrings, like the one for quantile, even explicitly say that
An error is raised if
wcontains anyNaNvalues.
but this wasn't the case without this PR.
Ideally, NaNs should also be supported by concrete weights types included into StatsBase (https://github.com/JuliaStats/StatsBase.jl/issues/904), but this PR is independent of that.
Nightly test failures unrelated
bump... would be nice to turn silently wrong results into errors here
another bump...
and another bump...
yet another bump...
yet yet another bump...
yet yet yet another bump...
The PR can't be merged? "This branch has conflicts that must be resolved" and tests are failing.
The PR can't be merged?
Idk the policy here, but saw that you approved these changes 1.5 months ago.
"This branch has conflicts that must be resolved"
I think these conflicts are due to code changes after this PR was created/approved. This is impossible to avoid in advance, of course the longer the PR stays unmerged the more conflicts will appear. Happy to update & resolve conflicts if you confirm that this PR will be merged after that.
tests are failing
Failures unrelated to changes in this PR:
Error During Test at /home/runner/work/StatsBase.jl/StatsBase.jl/test/scalarstats.jl:227
Unexpected Pass
Expression: (#= /home/runner/work/StatsBase.jl/StatsBase.jl/test/scalarstats.jl:227 =# @benchmark(mad($itr))).allocs < 200
Got correct result, please change to @test if no longer broken.
yet yet yet yet another bump...
yet yet yet yet yet another bump...
yet yet yet yet yet yet another bump...