Skip to content

feat: add stats/mskmax - #8917

Open
iampratik13 wants to merge 17 commits into
stdlib-js:developfrom
iampratik13:stats/mskmax
Open

iampratik13 wants to merge 17 commits into
stdlib-js:developfrom
iampratik13:stats/mskmax

Conversation

@iampratik13

Copy link
Copy Markdown
Member

Resolves None

Description

What is the purpose of this pull request?

This pull request:

  • feat: add stats/mskmax

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

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.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

{{TODO: add disclosure if applicable}}


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. labels Dec 9, 2025
@stdlib-bot

stdlib-bot commented Dec 9, 2025 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/mskmax $\\color{green}411/411$
$\\color{green}+0.48\\%$
$\\color{green}30/30$
$\\color{green}+3.57\\%$
$\\color{green}2/2$
$\\color{green}+0.00\\%$
$\\color{green}411/411$
$\\color{green}+0.48\\%$

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

Comment thread lib/node_modules/@stdlib/stats/mskmax/lib/main.js Outdated
@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Dec 10, 2025
@iampratik13
iampratik13 requested a review from kgryte December 17, 2025 06:43
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 17, 2025
@kgryte kgryte added Feature Issue or pull request for adding a new feature. and removed Needs Changes Pull request which needs changes before being merged. Needs Review A pull request which needs code review. labels Dec 17, 2025
Comment thread lib/node_modules/@stdlib/stats/mskmax/README.md Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/README.md
Comment thread lib/node_modules/@stdlib/stats/mskmax/benchmark/benchmark.assign.js Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/benchmark/benchmark.js Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/docs/repl.txt Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/docs/repl.txt Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/docs/repl.txt Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/docs/types/index.d.ts Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/docs/types/test.ts Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/docs/types/test.ts
Comment thread lib/node_modules/@stdlib/stats/mskmax/examples/index.js Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/examples/index.js Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/lib/assign.js Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/lib/assign.js Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/lib/base.js Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/lib/main.js Outdated
Comment thread lib/node_modules/@stdlib/stats/mskmax/lib/main.js Outdated

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Left some initial comments.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Dec 17, 2025
iampratik13 and others added 10 commits December 18, 2025 00:52
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Pratik  <bhagwatpratik781@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Pratik  <bhagwatpratik781@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Pratik  <bhagwatpratik781@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Pratik  <bhagwatpratik781@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Pratik  <bhagwatpratik781@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Pratik  <bhagwatpratik781@gmail.com>
@iampratik13

Copy link
Copy Markdown
Member Author

@kgryte done with changes.

@kgryte kgryte added Needs Review A pull request which needs code review. and removed Needs Changes Pull request which needs changes before being merged. labels Dec 20, 2025
Comment thread lib/node_modules/@stdlib/stats/mskmax/package.json
var mdtypes = dtypes( 'mask_index_and_generic' );
var odtypes = dtypes( 'real_and_generic' );
var policies = {
'output': 'same', // note: this is effectively ignored as we always specify the output data type explicitly

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Per style guide, NOTE annotations are // NOTE: (uppercase). Fix the casing.

Suggested change
'output': 'same', // note: this is effectively ignored as we always specify the output data type explicitly
'output': 'same', // NOTE: this is effectively ignored as we always specify the output data type explicitly

Generated by Claude Code

'float32',
'uint8', // smskmax: x, mask
'generic',
'uint8' // gmskmax: x, mask (note: gmskmax actually expects generic mask, but we convert)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same NOTE casing issue as above.

Suggested change
'uint8' // gmskmax: x, mask (note: gmskmax actually expects generic mask, but we convert)
'uint8' // gmskmax: x, mask (NOTE: gmskmax actually expects generic mask, but we convert)

Generated by Claude Code


function badValue( value ) {
return function badValue() {
mskmax( value );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Several of the option-validation tests here forget to pass mask, so the call throws on the missing/invalid mask argument before it ever hits the check the test is supposed to cover. mskmax( value ) never reaches the x dtype check because mask is undefined. Same problem at line 136 (mskmax( value, {} )), 195 (dtype option), 228 (keepdims option), 263 (dims type check), and 357 (dims duplicate-index check) — none of those paths are exercised right now. Add a valid mask ndarray to each call.


Generated by Claude Code


function badValue( value ) {
return function badValue() {
mskmax( x, mask, value );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These argument-validation tests are off by one. "second argument is not an ndarray-like object" (and its options variant, line 243) holds mask fixed and valid while varying out — mask's ndarray-like check gets zero coverage. Same bug one level down: "third argument is not an object" (line 283) holds out fixed and valid while varying options — out's check gets zero coverage. Fix each test to vary the argument named in its title.


Generated by Claude Code

@iampratik13
iampratik13 requested a review from a team October 3, 2026 19:19
---
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_pkg_readmes
    status: passed
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - 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: 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: passed
  - task: lint_license_headers
    status: passed
---
@iampratik13

Copy link
Copy Markdown
Member Author

@kgryte @Planeshifter Ready for review. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-review Feature Issue or pull request for adding a new feature. Needs Review A pull request which needs code review. review: 3 Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants