Skip to content

bench: refactor random number generation in stats/base/dists/studentized-range #5175

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 13 commits into from
Feb 17, 2025

Conversation

hrshya
Copy link
Contributor

@hrshya hrshya commented Feb 10, 2025


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 ---

Resolves #4987

Description

What is the purpose of this pull request?

This pull request:

Related Issues

Does this pull request have any related issues?

This pull request:

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_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. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. labels Feb 10, 2025
Copy link
Contributor

@stdlib-bot stdlib-bot left a comment

Choose a reason for hiding this comment

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

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

@stdlib-bot
Copy link
Contributor

stdlib-bot commented Feb 10, 2025

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/studentized-range/cdf $\color{red}649/709$
$\color{green}+91.54\%$
$\color{red}68/85$
$\color{green}+80.00\%$
$\color{green}9/9$
$\color{green}+100.00\%$
$\color{red}649/709$
$\color{green}+91.54\%$
stats/base/dists/studentized-range/quantile $\color{red}546/580$
$\color{green}+94.14\%$
$\color{red}64/80$
$\color{green}+80.00\%$
$\color{green}5/5$
$\color{green}+100.00\%$
$\color{red}546/580$
$\color{green}+94.14\%$

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

Comment on lines 39 to 41
q = uniform( 0.0, 12.0 );
r = uniform( 2.0, 20.0 );
v = uniform( 2.0, 20.0 );
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, q, r, and v should each be a Float64Array of length 100 and should be initialized in a loop. Reference PRs will help.

q = uniform( 0.0, 12.0 );
r = uniform( 2.0, 20.0 );
v = uniform( 2.0, 20.0 );
y = cdf( q, r, v );
Copy link
Contributor

Choose a reason for hiding this comment

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

This should still remain in the benchmarking loop, as it is the part being benchmarked.

Comment on lines 69 to 70
q = uniform( 0.0, 1.0 );
y = mycdf( q );
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above and applies throughout the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

std
Is this the right approach ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, considering you are using the correct range for random number generation.

@anandkaranubc anandkaranubc added the Needs Changes Pull request which needs changes before being merged. label Feb 10, 2025
---
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
---
@hrshya
Copy link
Contributor Author

hrshya commented Feb 11, 2025

I have made the changes. Can you please review it.

@hrshya hrshya marked this pull request as draft February 11, 2025 15:13
@hrshya hrshya marked this pull request as ready for review February 11, 2025 15:13
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Feb 11, 2025
Comment on lines 46 to 48
p[i] = uniform( 0.0, 1.0 );
r[i] = uniform( 2.0, 20.0 );
v[i] = uniform( 2.0, 20.0 );
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above, and applies throughout the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

hrshya and others added 5 commits February 11, 2025 22:15
…f/benchmark/benchmark.js

Co-authored-by: Karan Anand <[email protected]>
Signed-off-by: Harsh <[email protected]>
…f/benchmark/benchmark.js

Co-authored-by: Karan Anand <[email protected]>
Signed-off-by: Harsh <[email protected]>
…f/benchmark/benchmark.js

Co-authored-by: Karan Anand <[email protected]>
Signed-off-by: Harsh <[email protected]>
…antile/benchmark/benchmark.js

Co-authored-by: Karan Anand <[email protected]>
Signed-off-by: Harsh <[email protected]>
Signed-off-by: Harsh <[email protected]>
Copy link
Contributor

@anandkaranubc anandkaranubc left a comment

Choose a reason for hiding this comment

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

Just some minor changes; the rest of the PR looks ready for merge. Great work!

@stdlib-bot stdlib-bot removed the First-time Contributor A pull request from a contributor who has never previously committed to the project repository. label Feb 11, 2025
hrshya and others added 2 commits February 12, 2025 12:46
…antile/benchmark/benchmark.js

Co-authored-by: Karan Anand <[email protected]>
Signed-off-by: Harsh <[email protected]>
…antile/benchmark/benchmark.js

Co-authored-by: Karan Anand <[email protected]>
Signed-off-by: Harsh <[email protected]>
@hrshya hrshya requested a review from anandkaranubc February 13, 2025 09:37
@hrshya hrshya changed the title Updated benchmarks bench: refactor number generation Feb 13, 2025
@hrshya
Copy link
Contributor Author

hrshya commented Feb 17, 2025

Hi @anandkaranubc , Can you pls review it.

@anandkaranubc
Copy link
Contributor

Hi @anandkaranubc , Can you pls review it.

On it!

@anandkaranubc
Copy link
Contributor

/stdlib lint-autofix

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Feb 17, 2025
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Feb 17, 2025
Copy link
Contributor

@anandkaranubc anandkaranubc left a comment

Choose a reason for hiding this comment

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

Just some minor changes. Rest, the PR looks good!

Comment on lines 24 to 28
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var quantile = require( './../lib' );
var uniform = require('@stdlib/random/base/uniform');
var Float64Array = require( '@stdlib/array/float64' );
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var quantile = require( './../lib' );
var uniform = require('@stdlib/random/base/uniform');
var Float64Array = require( '@stdlib/array/float64' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var uniform = require( '@stdlib/random/base/uniform' );
var Float64Array = require( '@stdlib/array/float64' );
var pkg = require( './../package.json' ).name;
var quantile = require( './../lib' );

Just some rearrangement for consistency.

@anandkaranubc anandkaranubc removed the Needs Review A pull request which needs code review. label Feb 17, 2025
hrshya and others added 2 commits February 17, 2025 23:38
…f/benchmark/benchmark.js

Co-authored-by: Karan Anand <[email protected]>
Signed-off-by: Harsh <[email protected]>
…antile/benchmark/benchmark.js

Co-authored-by: Karan Anand <[email protected]>
Signed-off-by: Harsh <[email protected]>
@hrshya hrshya requested a review from anandkaranubc February 17, 2025 18:14
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Feb 17, 2025
@anandkaranubc
Copy link
Contributor

/stdlib lint-autofix

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Feb 17, 2025
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Feb 17, 2025
@anandkaranubc
Copy link
Contributor

@hrshya Can you also change the title to:

bench: refactor random number generation in stats/base/dists/studentized-range

Make sure you apply backticks around stats/base/dists/studentized-range

@hrshya hrshya changed the title bench: refactor number generation bench: refactor random number generation in stats/base/dists/studentized-range Feb 17, 2025
@hrshya
Copy link
Contributor Author

hrshya commented Feb 17, 2025

@anandkaranubc Done!

Copy link
Contributor

@anandkaranubc anandkaranubc left a comment

Choose a reason for hiding this comment

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

Great work! Time to wait for a maintainer to merge this PR :)

@anandkaranubc anandkaranubc added Ready To Merge A pull request which is ready to be merged. and removed Needs Review A pull request which needs code review. Needs Changes Pull request which needs changes before being merged. labels Feb 17, 2025
@stdlib-bot
Copy link
Contributor

PR Commit Message

bench: refactor random number generation in `stats/base/dists/studentized-range`

PR-URL: https://github.com/stdlib-js/stdlib/pull/5175
Closes: https://github.com/stdlib-js/stdlib/issues/4837
Closes: https://github.com/stdlib-js/stdlib/issues/4987
Ref: https://github.com/stdlib-js/stdlib/issues/4955

Co-authored-by: Harsh <[email protected]>
Co-authored-by: Karan Anand <[email protected]>
Co-authored-by: hrshya <[email protected]>
Co-authored-by: stdlib-bot <[email protected]>
Reviewed-by: anandkaranubc <[email protected]>
Signed-off-by: Harsh <[email protected]>

Please review the above commit message and make any necessary adjustments.

@Planeshifter
Copy link
Member

Thanks @hrshya for PR and @anandkaranubc for review; much appreciated!

@Planeshifter Planeshifter merged commit 2f54879 into stdlib-js:develop Feb 17, 2025
30 checks passed
@hrshya hrshya deleted the feature/studentized-range branch April 10, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready To Merge A pull request which is ready to be merged. Statistics Issue or pull request related to statistical functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: Refactor random number generation in JS benchmarks for stats/base/dists/studentized-range
4 participants