Skip to content

Fix in Distributions.Beta: avoid possible NaN caused by x==y==0 when a and b are both small#894

Merged
cdrnet merged 5 commits intomathnet:masterfrom
Ebola-Chan-bot:master
Jan 24, 2022
Merged

Fix in Distributions.Beta: avoid possible NaN caused by x==y==0 when a and b are both small#894
cdrnet merged 5 commits intomathnet:masterfrom
Ebola-Chan-bot:master

Conversation

@Ebola-Chan-bot
Copy link
Copy Markdown
Contributor

Current master will possibly generate NaN when a and b are both small(<0.001). NaN is produced when x and y are accidentally both zero. We should regenerate the (x,y) pair when this happens.
We can't just apply a Bernoulli(p=0.5) to randomly give x or y a non-zero value, since they are only equally possible when a==b.

@Ebola-Chan-bot Ebola-Chan-bot changed the title Make Distributions.Beta.Sample equally possible to generate 0 or 1 but not NaN when a and b are both small Avoid possible NaN caused by x==y==0 when a and b are both small Jan 8, 2022
@Ebola-Chan-bot Ebola-Chan-bot changed the title Avoid possible NaN caused by x==y==0 when a and b are both small Fix in Distributions.Beta: avoid possible NaN caused by x==y==0 when a and b are both small Jan 8, 2022
@cdrnet
Copy link
Copy Markdown
Member

cdrnet commented Jan 24, 2022

Thank you!

We can bring this already into master/v5.

@cdrnet cdrnet merged commit 1834d64 into mathnet:master Jan 24, 2022
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.

2 participants