feat: add stats/strided/dmadfmsorted#9895
feat: add stats/strided/dmadfmsorted#9895Om-A-osc wants to merge 4 commits intostdlib-js:developfrom
stats/strided/dmadfmsorted#9895Conversation
---
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: missing_dependencies
- task: lint_c_examples
status: missing_dependencies
- task: lint_c_benchmarks
status: missing_dependencies
- 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
---
stats/strided/dmadsorted ( median absolute deviation )
Coverage Report
The above coverage report was generated for the changes in this PR. |
---
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: passed
- 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: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
|
Hey @kgryte, I hope this doesn’t already exist (I checked and couldn’t find it). The median absolute deviation (MAD) would be a really valuable addition to stats/strided. Please take a look when you get a chance. |
lib/node_modules/@stdlib/stats/strided/dmadsorted/lib/ndarray.js
Outdated
Show resolved
Hide resolved
stats/strided/dmadsorted ( median absolute deviation )stats/strided/dmadsorted
---
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: passed
- 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: passed
- task: lint_license_headers
status: passed
---
stats/strided/dmadsortedstats/strided/dmadfmsorted
|
Hi @kgryte thank you for the earlier review and feedback. The previous implementation of the median absolute deviation from the median was intentionally written for simplicity, motivated by an earlier discussion Based on your comments, I’ve now done a full refactor and updated the implementation to use an O(log N) algorithm, which is the optimal complexity for computing MADFM for already-sorted arrays. Along with this refactor, I’ve also renamed the API to At a high level, the new algorithm works as follows:
Because this is a complete algorithmic refactor rather than an incremental change, some of the earlier review comments no longer apply in the current version. If you have time, I’d really appreciate another look at the updated implementation when convenient. Thanks again for the guidance it was very helpful in pushing this toward a more optimal and idiomatic solution. |
---
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: 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:
status: passed
status: passed
status: passed
status: passed
status: passed
status: passed
status: na
status: passed
status: passed
status: passed
status: na
status: na
status: missing_dependencies
status: missing_dependencies
status: missing_dependencies
status: na
status: na
status: passed
status: passed
status: passed
Resolves #N/A.
Description
This pull request introduces a new
stats/stridedpackage,dmadsorted, which computes the median absolute deviation (MAD) for sorted double-precision floating-point strided arrays.The median absolute deviation is a robust measure of statistical dispersion that is less sensitive to outliers than variance or standard deviation. Adding
dmadsortedextends the existing family of strided statistical functions (e.g.,dmediansorted) and provides a commonly used robust statistic in a performance-oriented, strided form.This PR includes:
stats/strided/*sortedconventionsRelated Issues
This pull request has no related issues.
Questions
No.
Other
The implementation assumes sorted input, consistent with other
*sortedstrided APIs.Checklist
AI Assistance
@stdlib-js/reviewers