Skip to content

bench: fix isnan checks in stats/base/dists #5296

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

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

anandkaranubc
Copy link
Contributor

Resolves none.

Thanks @G4URAV001 for pointing this bug.

Description

What is the purpose of this pull request?

This pull request:

  • Replaces isnan( y ) with isnan( dist.a ), isnan( dist.b ), etc., using the appropriate parameters.
  • Ensures consistency and correctness in isnan checks throughout the package.

Related Issues

Does this pull request have any related issues?

This pull request:

  • resolves none

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: na
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---

---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: na
  - task: run_c_examples
    status: na
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: na
  - task: run_c_benchmarks
    status: na
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: na
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. labels Feb 18, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Feb 18, 2025

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/arcsine/ctor $\color{green}468/468$
$\color{green}+100.00\%$
$\color{green}43/43$
$\color{green}+100.00\%$
$\color{green}18/18$
$\color{green}+100.00\%$
$\color{green}468/468$
$\color{green}+100.00\%$
stats/base/dists/bernoulli/ctor $\color{green}409/409$
$\color{green}+100.00\%$
$\color{green}26/26$
$\color{green}+100.00\%$
$\color{green}15/15$
$\color{green}+100.00\%$
$\color{green}409/409$
$\color{green}+100.00\%$
stats/base/dists/beta/ctor $\color{green}487/487$
$\color{green}+100.00\%$
$\color{green}34/34$
$\color{green}+100.00\%$
$\color{green}19/19$
$\color{green}+100.00\%$
$\color{green}487/487$
$\color{green}+100.00\%$
stats/base/dists/betaprime/ctor $\color{green}419/419$
$\color{green}+100.00\%$
$\color{green}31/31$
$\color{green}+100.00\%$
$\color{green}16/16$
$\color{green}+100.00\%$
$\color{green}419/419$
$\color{green}+100.00\%$
stats/base/dists/binomial/ctor $\color{green}439/439$
$\color{green}+100.00\%$
$\color{green}32/32$
$\color{green}+100.00\%$
$\color{green}17/17$
$\color{green}+100.00\%$
$\color{green}439/439$
$\color{green}+100.00\%$
stats/base/dists/cauchy/ctor $\color{green}363/363$
$\color{green}+100.00\%$
$\color{green}30/30$
$\color{green}+100.00\%$
$\color{green}13/13$
$\color{green}+100.00\%$
$\color{green}363/363$
$\color{green}+100.00\%$
stats/base/dists/chi/ctor $\color{green}387/387$
$\color{green}+100.00\%$
$\color{green}25/25$
$\color{green}+100.00\%$
$\color{green}14/14$
$\color{green}+100.00\%$
$\color{green}387/387$
$\color{green}+100.00\%$
stats/base/dists/chisquare/ctor $\color{green}406/406$
$\color{green}+100.00\%$
$\color{green}26/26$
$\color{green}+100.00\%$
$\color{green}15/15$
$\color{green}+100.00\%$
$\color{green}406/406$
$\color{green}+100.00\%$
stats/base/dists/cosine/ctor $\color{green}469/469$
$\color{green}+100.00\%$
$\color{green}35/35$
$\color{green}+100.00\%$
$\color{green}18/18$
$\color{green}+100.00\%$
$\color{green}469/469$
$\color{green}+100.00\%$
stats/base/dists/degenerate/ctor $\color{green}495/495$
$\color{green}+100.00\%$
$\color{green}30/30$
$\color{green}+100.00\%$
$\color{green}17/17$
$\color{green}+100.00\%$
$\color{green}495/495$
$\color{green}+100.00\%$
stats/base/dists/discrete-uniform/ctor $\color{green}478/478$
$\color{green}+100.00\%$
$\color{green}39/39$
$\color{green}+100.00\%$
$\color{green}18/18$
$\color{green}+100.00\%$
$\color{green}478/478$
$\color{green}+100.00\%$
stats/base/dists/erlang/ctor $\color{green}439/439$
$\color{green}+100.00\%$
$\color{green}32/32$
$\color{green}+100.00\%$
$\color{green}17/17$
$\color{green}+100.00\%$
$\color{green}439/439$
$\color{green}+100.00\%$
stats/base/dists/exponential/ctor $\color{green}466/466$
$\color{green}+100.00\%$
$\color{green}28/28$
$\color{green}+100.00\%$
$\color{green}17/17$
$\color{green}+100.00\%$
$\color{green}466/466$
$\color{green}+100.00\%$
stats/base/dists/f/ctor $\color{green}378/378$
$\color{green}+100.00\%$
$\color{green}30/30$
$\color{green}+100.00\%$
$\color{green}15/15$
$\color{green}+100.00\%$
$\color{green}378/378$
$\color{green}+100.00\%$
stats/base/dists/frechet/ctor $\color{red}478/479$
$\color{green}+99.79\%$
$\color{red}39/40$
$\color{green}+97.50\%$
$\color{green}20/20$
$\color{green}+100.00\%$
$\color{red}478/479$
$\color{green}+99.79\%$
stats/base/dists/gamma/ctor $\color{green}468/468$
$\color{green}+100.00\%$
$\color{green}33/33$
$\color{green}+100.00\%$
$\color{green}18/18$
$\color{green}+100.00\%$
$\color{green}468/468$
$\color{green}+100.00\%$
stats/base/dists/geometric/ctor $\color{green}469/469$
$\color{green}+100.00\%$
$\color{green}28/28$
$\color{green}+100.00\%$
$\color{green}17/17$
$\color{green}+100.00\%$
$\color{green}469/469$
$\color{green}+100.00\%$
stats/base/dists/gumbel/ctor $\color{red}486/488$
$\color{green}+99.59\%$
$\color{red}33/34$
$\color{green}+97.06\%$
$\color{green}19/19$
$\color{green}+100.00\%$
$\color{red}486/488$
$\color{green}+99.59\%$
stats/base/dists/hypergeometric/ctor $\color{green}415/415$
$\color{green}+100.00\%$
$\color{green}41/41$
$\color{green}+100.00\%$
$\color{green}17/17$
$\color{green}+100.00\%$
$\color{green}415/415$
$\color{green}+100.00\%$
stats/base/dists/invgamma/ctor $\color{green}408/408$
$\color{green}+100.00\%$
$\color{green}31/31$
$\color{green}+100.00\%$
$\color{green}16/16$
$\color{green}+100.00\%$
$\color{green}408/408$
$\color{green}+100.00\%$
stats/base/dists/logistic/ctor $\color{green}488/488$
$\color{green}+100.00\%$
$\color{green}36/36$
$\color{green}+100.00\%$
$\color{green}19/19$
$\color{green}+100.00\%$
$\color{green}488/488$
$\color{green}+100.00\%$
stats/base/dists/lognormal/ctor $\color{green}458/458$
$\color{green}+100.00\%$
$\color{green}35/35$
$\color{green}+100.00\%$
$\color{green}18/18$
$\color{green}+100.00\%$
$\color{green}458/458$
$\color{green}+100.00\%$
stats/base/dists/negative-binomial/ctor $\color{green}420/420$
$\color{green}+100.00\%$
$\color{green}31/31$
$\color{green}+100.00\%$
$\color{green}16/16$
$\color{green}+100.00\%$
$\color{green}420/420$
$\color{green}+100.00\%$
stats/base/dists/pareto-type1/ctor $\color{green}438/438$
$\color{green}+100.00\%$
$\color{green}32/32$
$\color{green}+100.00\%$
$\color{green}17/17$
$\color{green}+100.00\%$
$\color{green}438/438$
$\color{green}+100.00\%$
stats/base/dists/poisson/ctor $\color{green}442/442$
$\color{green}+100.00\%$
$\color{green}27/27$
$\color{green}+100.00\%$
$\color{green}16/16$
$\color{green}+100.00\%$
$\color{green}442/442$
$\color{green}+100.00\%$
stats/base/dists/uniform/ctor $\color{green}479/479$
$\color{green}+100.00\%$
$\color{green}43/43$
$\color{green}+100.00\%$
$\color{green}18/18$
$\color{green}+100.00\%$
$\color{green}479/479$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this PR.

@anandkaranubc
Copy link
Contributor Author

@kgryte, here is an initial refactoring for stats/base/dists/arcsine. I expected it to be more involved, but it seems that changes are only needed in the ctor files, specifically in the ::set:* benchmarks. I hope I’m not missing anything. If everything looks good, I will update the current PR to include changes for the entire package.

@kgryte
Copy link
Member

kgryte commented Feb 19, 2025

@anandkaranubc Looks good to me, thus far.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Feb 19, 2025
… package

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: na
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---

---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: na
  - task: run_c_examples
    status: na
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: na
  - task: run_c_benchmarks
    status: na
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: passed
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---
@anandkaranubc
Copy link
Contributor Author

@anandkaranubc Looks good to me, thus far.

Thanks! It has been updated throughout the package now.

@kgryte kgryte removed the Needs Changes Pull request which needs changes before being merged. label Feb 20, 2025
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for following up on this, @anandkaranubc!

@kgryte kgryte changed the title fix: update isnan checks to use appropriate parameters in stats/base/dists bench: fix isnan checks in stats/base/dists Feb 20, 2025
@kgryte kgryte added the Benchmarks Pull requests adding or improving benchmarks for measuring performance. label Feb 20, 2025
@kgryte kgryte merged commit f7988d3 into stdlib-js:develop Feb 20, 2025
28 checks passed
@anandkaranubc anandkaranubc deleted the fix/arcsine-bug branch February 20, 2025 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Benchmarks Pull requests adding or improving benchmarks for measuring performance. Statistics Issue or pull request related to statistical functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants