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

functions that only support finite weights now throw errors for non-finites #914

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

aplavin
Copy link
Contributor

@aplavin aplavin commented Jan 21, 2024

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 w contains any NaN values.

but this wasn't the case without this PR.

Ideally, NaNs should also be supported by concrete weights types included into StatsBase (#904), but this PR is independent of that.

@aplavin aplavin changed the title functions that only support finite weights now throw errors functions that only support finite weights now throw errors for non-finites Jan 21, 2024
@aplavin
Copy link
Contributor Author

aplavin commented Jan 21, 2024

Nightly test failures unrelated

@aplavin
Copy link
Contributor Author

aplavin commented Feb 6, 2024

bump...
would be nice to turn silently wrong results into errors here

src/sampling.jl Outdated Show resolved Hide resolved
@aplavin
Copy link
Contributor Author

aplavin commented Mar 3, 2024

another bump...

@aplavin
Copy link
Contributor Author

aplavin commented Mar 27, 2024

and another bump...

@aplavin
Copy link
Contributor Author

aplavin commented Apr 8, 2024

yet another bump...

@aplavin
Copy link
Contributor Author

aplavin commented Apr 18, 2024

yet yet another bump...

@aplavin
Copy link
Contributor Author

aplavin commented Apr 30, 2024

yet yet yet another bump...

@devmotion
Copy link
Member

devmotion commented Apr 30, 2024

The PR can't be merged? "This branch has conflicts that must be resolved" and tests are failing.

@aplavin
Copy link
Contributor Author

aplavin commented Apr 30, 2024

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.

@aplavin
Copy link
Contributor Author

aplavin commented May 16, 2024

yet yet yet yet another bump...

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.

None yet

2 participants