-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: add stats/incr/nanmme #9460
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
base: develop
Are you sure you want to change the base?
Conversation
---
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: passed
- 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
---
|
👋 Hi there! 👋 And thank you for opening your first pull request! We will review it shortly. 🏃 💨 Getting Started
Next Steps
Running Tests LocallyYou can use # Run tests for all packages in the math namespace:
make test TESTS_FILTER=".*/@stdlib/math/.*"
# Run benchmarks for a specific package:
make benchmark BENCHMARKS_FILTER=".*/@stdlib/math/base/special/sin/.*"If you haven't heard back from us within two weeks, please ping us by tagging the "reviewers" team in a comment on this PR. If you have any further questions while waiting for a response, please join our Zulip community to chat with project maintainers and other community members. We appreciate your contribution! Documentation Links |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| bench( format( '%s::accumulator-nan', pkg ), function benchmark( b ) { |
According to current project conventions, we are moving away from string concatenation while specifying javascript benchmark names. Instead it is recommended to use @stdlib/string/format.
For more information, you can check out this reference: #8647
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "name": "@stdlib/stats/incr/nanmme", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| tape( 'accumulator computes moving mean error incrementally', function testIncrementalBehavior( t ) { | |
| var expected = [ 1, -1.5, 0, -3, -8/3, -2/3 ]; | |
| var actual; | |
| var data = [ | |
| [ 2, 3 ], | |
| [ 3, -1 ], | |
| [ 2, 5 ], | |
| [ 4, -4 ], | |
| [ 3, 0 ], | |
| [ -4, 5 ] | |
| ]; | |
| var acc = incrNanMme( 3 ); | |
| for ( i = 0; i < data.length; i++ ) { | |
| actual = acc( data[ i ][ 0 ], data[ i ][ 1 ] ); | |
| t.strictEqual( ulpdiff( actual, expected[i] ) <= 1, true, 'returns expected value' ); | |
| } | |
| t.end(); | |
| }); |
According to latest project conventions, it is preferred to use ulpdiff instead of calculating tolerance values.
var ulpdiff = require( '@stdlib/number/float64/base/ulp-difference' );This applies to all the tests below too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| > Compute a moving [mean error][mean-absolute-error] (ME) incrementally, ignoring `NaN` values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // returns ~5.33 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies to all decimal return values across the package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // returns ~5.67 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // returns ~5.67 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is auto-generated using tools, it is expected to leave this section blank.
---
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: passed
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- 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: na
- task: lint_license_headers
status: passed
---
|
@nakul-krishnakumar This PR is ready for review. |
Resolves #5587
Description
This pull request:
Implement NaN handling in the nanmme accumulator function in stats/incr/nanmme.
Ensures that NaN inputs are ignored without breaking the incremental moving mean error computation.
Passes all existing test cases and maintains backward compatibility.
Other
results of benchmark -
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
@stdlib-js/reviewers