Skip to content

feat: add stats/incr/nanmmeanstdev #6606

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 9 commits into
base: develop
Choose a base branch
from

Conversation

saad-imran-dev
Copy link
Contributor


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: passed
  • task: lint_repl_help status: na
  • task: lint_javascript_src status: passed
  • task: lint_javascript_cli status: na
  • task: lint_javascript_examples status: passed
  • task: lint_javascript_tests status: passed
  • 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: passed
  • task: lint_typescript_tests status: passed
  • task: lint_license_headers status: passed ---

Resolves #5591

Description

What is the purpose of this pull request?

This pull request:

  • It adds module which is a wrapper around mmeanstdev for handling NaN values. It ignores any NaN values passes in the accumulator

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_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: passed
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: passed
  - 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: passed
  - task: lint_typescript_tests
    status: passed
  - 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: 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
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Apr 8, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Apr 8, 2025

Coverage Report

Package Statements Branches Functions Lines
stats/incr/nanmmeanstdev $\color{green}213/213$
$\color{green}+100.00\%$
$\color{green}10/10$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}213/213$
$\color{green}+100.00\%$

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

@ShabiShett07
Copy link
Contributor

/stdlib update-copyright-years

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

@saad-imran-dev, please update your pr title to:

feat: add `stats/incr/nanmmeanstdev`

to pass the pr title check.

@saad-imran-dev saad-imran-dev changed the title Feat: add stats/incr/nanmmeanstdev feat: add stats/incr/nanmmeanstdev May 3, 2025
saad-imran-dev and others added 3 commits May 3, 2025 21:20
// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
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 randu = require( '@stdlib/random/base/randu' );

I think we don't need to use this package, instead we could just pass iteration number as input


b.tic();
for ( i = 0; i < b.iterations; i++ ) {
v = acc( randu() );
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
v = acc( randu() );
v = acc( i );

Same reason

<section class="notes">

## Notes

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
- Input values are **not** type checked. If non-numeric inputs are possible, you are advised to type check and handle accordingly **before** passing the value to the accumulator function.

Copy link
Contributor

Choose a reason for hiding this comment

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

This specifies that non numeric inputs are allowed in this package

* limitations under the License.
*/

'use strict';
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the examples should be updated as we need to pass NaN values too in the input, please refer other similar packages.

<!-- eslint no-undef: "error" -->

```javascript
var randu = require( '@stdlib/random/base/randu' );
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

@ShabiShett07
Copy link
Contributor

@saad-imran-dev, I think your implementation is missing repl.txt file

import { ArrayLike } from '@stdlib/types/array';

/**
* If provided a value, the accumulator function returns an updated moving arithmetic mean and corrected sample standard deviation. If provided NaN or no value, the accumulator function returns the current moving arithmetic mean and corrected sample standard deviation.
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
* If provided a value, the accumulator function returns an updated moving arithmetic mean and corrected sample standard deviation. If provided NaN or no value, the accumulator function returns the current moving arithmetic mean and corrected sample standard deviation.
* If provided a value, the accumulator function returns an updated moving arithmetic mean and corrected sample standard deviation. If provided `NaN` or no value, the accumulator function returns the current moving arithmetic mean and corrected sample standard deviation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here and elsewhere

saad-imran-dev and others added 2 commits May 6, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First PR A pull request resolving a Good First Issue. Needs Review A pull request which needs code review. Statistics Issue or pull request related to statistical functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: add stats/incr/nanmmeanstdev
3 participants