Skip to content

docs: normalize return type and keyword in ml/base/kmeans collection packages#13524

Draft
Planeshifter wants to merge 2 commits into
developfrom
claude/busy-mayer-u1oq6d
Draft

docs: normalize return type and keyword in ml/base/kmeans collection packages#13524
Planeshifter wants to merge 2 commits into
developfrom
claude/busy-mayer-u1oq6d

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves None.

Description

What is the purpose of this pull request?

This pull request normalizes two internal documentation/metadata inconsistencies in the ml/base/kmeans enumeration-table packages, bringing the algorithms and metrics mirror packages into agreement with each other and with their sibling packages:

ml/base/kmeans/metrics

The main export documented its return type as @returns {StringArray}, contradicting both the mirror algorithms package (Array<string>) and this package's own TypeScript declaration (declare function metrics(): Array<string>;). The function returns DATA.slice() — a plain string array — identical to algorithms. Corrected the JSDoc to {Array<string>}.

ml/base/kmeans/algorithms

The keywords array carried the plural algorithms; every other namespace member uses a singular domain keyword (the mirror metrics uses metric; the algorithm-* resolvers use algorithm). 9/10 members use the singular form. Switched to algorithm.

Related Issues

Does this pull request have any 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.

Both changes are documentation/metadata only — no runtime behavior, public signature, or test-expectation changes. Conformance: the Array<string> return type is used by the mirror algorithms package and by both packages' .d.ts declarations; the singular-keyword convention holds for 9/10 members of the namespace. The two collection packages (algorithms, metrics) are otherwise byte-identical modulo their enum contents and domain nouns, which is what surfaced these two asymmetries.

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

This PR was authored by Claude Code. It analyzed the ml/base/kmeans namespace for cross-package drift, compared each package's structural and semantic features against the majority pattern of its siblings, identified the two inconsistencies above, and applied the fixes. Each change was verified against the mirror package and the TypeScript declarations before committing.


@stdlib-js/reviewers


Generated by Claude Code

claude added 2 commits July 17, 2026 16:21
Normalize the domain keyword in the `keywords` array from the plural
`algorithms` to the singular `algorithm`. This matches the mirror
collection package `ml/base/kmeans/metrics` (which uses `metric`) and
the sibling `algorithm-*` resolver packages; 9/10 namespace members use
a singular domain keyword. The plural was an inadvertent copy artifact
and appears in no sibling package.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FTLvLifsfJWGfMYJAJZ11h
Correct the `@returns` JSDoc type on the main export from `StringArray`
to `Array<string>`, matching the mirror collection package
`ml/base/kmeans/algorithms` and the TypeScript declaration present in
both packages (`declare function metrics(): Array<string>;`). The
function returns `DATA.slice()`, a plain string array, so `Array<string>`
is the canonical type; `StringArray` contradicted the package's own
type declaration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FTLvLifsfJWGfMYJAJZ11h
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
ml/base/kmeans/algorithms $\\color{green}142/142$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}142/142$
$\\color{green}+100.00\\%$
ml/base/kmeans/metrics $\\color{green}148/148$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}148/148$
$\\color{green}+100.00\\%$

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants