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

Ensure Uniform constructed on bounded interval #218

Merged
merged 3 commits into from
May 25, 2024
Merged

Conversation

YeungOnion
Copy link
Contributor

In looking at lints (#216, has some of the discussion there) adjacently found that Uniform would allow infinite support. I don't know enough to say if this is well defined mathematically, but a few implications I thought of:

  • sample will fail while using rand's UniformSampler
  • cdf and sf have odd end behaviors for the unbounded end, is F(x = INF) = 1 if X ~ Uni(a, INF)? Equals INF isn't good math, but is valid value for floats

There may be others, but this PR would disallow construction of such a distribution, sf was implemented to have behavior for infinite support, but cdf was not. If someone can declare how it should work, then we can reallow it and implement all the behavior for it.

@YeungOnion
Copy link
Contributor Author

YeungOnion commented Apr 22, 2024

I removed tests that didn't require that a, b < ∞ AND a<b but I noticed there were tests that specifically tested such behavior, most notably things like

  • $f_U(x;a=b) \equiv f_δ(x-a)$ δ being the dirac delta
  • testing cdf at x=∞ for uniform without upper bound.

The blame shows @boxtown writing some of those tests 8 years ago and some from @dcraven 3 years ago. Don't suppose you recall why you chose that before, do you? I'd like to know more about what I'm considering removing.

EDIT:
Mention @dcraven's additions, despite not being able to find his gh account

@YeungOnion
Copy link
Contributor Author

More discussion is needed on what's expected behavior for such degenerate cases, #102 will host future discussion, for now I'll exclude this degenerate case.

@YeungOnion YeungOnion merged commit 36b2145 into master May 25, 2024
2 checks passed
@YeungOnion YeungOnion deleted the bounded-uniform branch May 25, 2024 00:01
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.

1 participant