Skip to content

Conversation

aayush0325
Copy link
Member

Resolves None

Description

What is the purpose of this pull request?

This pull request:

  • adds C ndarray intreface for stats/base/dnamin
  • refactors JavaScript implementation
  • refactors tests, docs, benchmarks and examples.

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

@aayush0325 aayush0325 marked this pull request as draft December 25, 2024 19:48
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Dec 25, 2024
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Dec 25, 2024

Coverage Report

Package Statements Branches Functions Lines
stats/base/dnanmin $\color{green}381/381$
$\color{green}+100.00\%$
$\color{green}31/31$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}381/381$
$\color{green}+100.00\%$

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

---
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: passed
---
@aayush0325 aayush0325 changed the title feat: add C ndarray interface for and refactor implementation for stats/base/dnanmin feat: add C ndarray interface and refactor implementation for stats/base/dnanmin Dec 25, 2024
---
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: passed
  - 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: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: passed
  - task: lint_c_benchmarks
    status: passed
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
---
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: passed
  - 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: na
  - 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
---
@aayush0325 aayush0325 marked this pull request as ready for review December 25, 2024 20:08
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 25, 2024
@aayush0325
Copy link
Member Author

Same question here as #4206, What to use for generating random arrays with NaN values, left the JS examples and benchmarks untouched for now

@Planeshifter Planeshifter added the Ready To Merge A pull request which is ready to be merged. label Dec 25, 2024
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Dec 25, 2024
@stdlib-bot
Copy link
Contributor

PR Commit Message

feat: add C ndarray interface and refactor implementation for `stats/base/dnanmin`

PR-URL: https://github.com/stdlib-js/stdlib/pull/4235

Co-authored-by: aayush0325 <[email protected]>
Reviewed-by: Philipp Burckhardt <[email protected]>

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

@Planeshifter
Copy link
Member

@aayush0325

We have done things like this:

var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var bernoulli = require( '@stdlib/random/base/bernoulli' );
var filledarrayBy = require( '@stdlib/array/filled-by' );

function rand() {
        if ( bernoulli( 0.2 ) ) {
                return NaN;
        }
        return discreteUniform( 0, 100 );
}

var x = filledarrayBy( 10, 'float64', rand );

@aayush0325
Copy link
Member Author

@aayush0325

We have done things like this:

var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var bernoulli = require( '@stdlib/random/base/bernoulli' );
var filledarrayBy = require( '@stdlib/array/filled-by' );

function rand() {
        if ( bernoulli( 0.2 ) ) {
                return NaN;
        }
        return discreteUniform( 0, 100 );
}

var x = filledarrayBy( 10, 'float64', rand );

I'll push the required changes here and everywhere else, Thanks @Planeshifter!

---
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
---
@aayush0325
Copy link
Member Author

aayush0325 commented Dec 26, 2024

I've pushed a fix, let me know if there's anything to be changed here @Planeshifter. I'll make similar changes in all my other PRs after i get the green light here

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 26, 2024
@kgryte kgryte removed the Ready To Merge A pull request which is ready to be merged. label Dec 26, 2024
@Planeshifter
Copy link
Member

Planeshifter commented Dec 26, 2024

@aayush0325 To preserve the existing behavior and range of generated values, might be better to use the uniform instead of discrete uniform, as it looks like we didn't just benchmark for integer values here. I only meant the code snippet as an example of how we have done it elsewhere, namely in some of the extended BLAS base packages, not that we should change to discrete uniform or draw from a different range than was previously done.

Otherwise looks good to me.

@aayush0325
Copy link
Member Author

ah, my bad i'll revert the commit just a sec

This reverts commit 8311cbc.

---
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
---
@aayush0325
Copy link
Member Author

aayush0325 commented Dec 26, 2024

please give this a final look @Planeshifter! sorry for the misunderstanding.

---
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
---
@Planeshifter
Copy link
Member

@aayush0325 Just pushed a commit with what I envisioned: Basically updating the benchmarks to avoid the for-loops while not changing the distribution from which the values are drawn. Does that make sense?

Thanks for the PR and your proactive approach in updating open ones, which makes life as a reviewer much easier!

I can merge this PR shortly after CI once all checks are green.

@Planeshifter Planeshifter added the Ready To Merge A pull request which is ready to be merged. label Dec 26, 2024
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Dec 26, 2024
@stdlib-bot
Copy link
Contributor

PR Commit Message

feat: add C ndarray interface and refactor implementation for `stats/base/dnanmin`

PR-URL: https://github.com/stdlib-js/stdlib/pull/4235

Co-authored-by: Philipp Burckhardt <[email protected]>
Co-authored-by: aayush0325 <[email protected]>
Reviewed-by: Philipp Burckhardt <[email protected]>

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

@aayush0325
Copy link
Member Author

Basically updating the benchmarks to avoid the for-loops while not changing the distribution from which the values are drawn. Does that make sense?

got it, updating all other similar PRs like this soon, thanks for all your help!

@Planeshifter Planeshifter merged commit e6e539d into stdlib-js:develop Dec 26, 2024
28 checks passed
Neerajpathak07 pushed a commit to Neerajpathak07/stdlib that referenced this pull request Jan 1, 2025
…base/dnanmin`

PR-URL: stdlib-js#4235

Co-authored-by: Philipp Burckhardt <[email protected]>
Reviewed-by: Philipp Burckhardt <[email protected]>
@aayush0325 aayush0325 deleted the ndarray-dnanmin branch January 8, 2025 19:04
ShabiShett07 pushed a commit to ShabiShett07/stdlib that referenced this pull request Feb 26, 2025
…base/dnanmin`

PR-URL: stdlib-js#4235

Co-authored-by: Philipp Burckhardt <[email protected]>
Reviewed-by: Philipp Burckhardt <[email protected]>
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.

4 participants