Skip to content

fix: Fix binomial_cdf disparity #13700

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

skyelves
Copy link
Contributor

@skyelves skyelves commented Jun 9, 2025

Summary:
Fix binomial_cdf disparity

T226113911

In java, if value >= numberOfTrials, directly return 1.0

public double cumulativeProbability(int x) {
        double ret;
        if (x < 0) {
            ret = (double)0.0F;
        } else if (x >= this.numberOfTrials) {
            ret = (double)1.0F;
        } else {
            ret = (double)1.0F - Beta.regularizedBeta(this.probabilityOfSuccess, (double)x + (double)1.0F, (double)(this.numberOfTrials - x));
        }

        return ret;
    } 

In cpp, it throws an error in boost lib

if(k > N)
{
       *result = policies::raise_domain_error<RealType>(
          function,
          "Number of Successes argument is %1%, but must be <= Number of Trials !", k, pol);
       return false;
}

Differential Revision: D76301965

Summary:
Fix binomial_cdf disparity

T226113911

In java, if value >= numberOfTrials, directly return 1.0
```
public double cumulativeProbability(int x) {
        double ret;
        if (x < 0) {
            ret = (double)0.0F;
        } else if (x >= this.numberOfTrials) {
            ret = (double)1.0F;
        } else {
            ret = (double)1.0F - Beta.regularizedBeta(this.probabilityOfSuccess, (double)x + (double)1.0F, (double)(this.numberOfTrials - x));
        }

        return ret;
    } 
```

In cpp, it throws an error in boost lib

``` 
if(k > N)
{
       *result = policies::raise_domain_error<RealType>(
          function,
          "Number of Successes argument is %1%, but must be <= Number of Trials !", k, pol);
       return false;
}
```

Differential Revision: D76301965
Copy link

netlify bot commented Jun 9, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 9587646
🔍 Latest deploy log https://app.netlify.com/projects/meta-velox/deploys/68475e882e61320008346b20

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76301965

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Jun 9, 2025
Copy link
Contributor

@amitkdutta amitkdutta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @skyelves

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants