Skip to content

Conversation

@24archit
Copy link

@24archit 24archit commented Dec 27, 2025


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 ---

Description

What is the purpose of this pull request?

This pull request:

  • Implements the entropy function for the Hypergeometric distribution.
  • Adds comprehensive documentation (README and REPL help) with mathematical formulas and usage examples.
  • Adds unit tests and benchmarks for both JavaScript and C implementations.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • No

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.

  • image
  • Local linting passed for JavaScript and Markdown files. Cppcheck was not run locally due to missing dependencies but the code compiles successfully.

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.".

  • I used AI tools (Google Gemini) primarily for documentation support and research, including understanding the mathematical formula for hypergeometric entropy and verifying test cases and example outputs. All implementation code and final logic were written and reviewed manually by me.

@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: 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
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. labels Dec 27, 2025
@kgryte
Copy link
Member

kgryte commented Dec 27, 2025

/stdlib update-copyright-years

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Dec 27, 2025
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Dec 27, 2025
* var h = entropy( 10, 5, 12 );
* // returns NaN
*/
function entropy(N, K, n) {
Copy link
Member

Choose a reason for hiding this comment

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

You should update your use of whitespace here and below in order to be consistent within this package and with the rest of stdlib.

Suggested change
function entropy(N, K, n) {
function entropy( N, K, n ) {

max = (n < K) ? n : K;

H = 0.0;
for (k = min; k <= max; k++) {
Copy link
Member

Choose a reason for hiding this comment

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

This approach seems to match SciPy: https://github.com/scipy/scipy/blob/v1.16.2/scipy/stats/_discrete_distns.py#L704. For more robust summation, we could consider an accumulator which isn't ordinary recursive summation (e.g., https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/sum).

@kgryte kgryte added the Feature Issue or pull request for adding a new feature. label Dec 27, 2025
@kgryte kgryte requested a review from Planeshifter December 27, 2025 11:53
@kgryte
Copy link
Member

kgryte commented Dec 27, 2025

@24archit You'll need to resolve CI failures before this PR can move forward. Thanks!

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

Labels

Feature Issue or pull request for adding a new feature. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. 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.

3 participants