Skip to content

feat: add ml/base/kmeans/algorithms#10796

Open
nakul-krishnakumar wants to merge 7 commits intostdlib-js:developfrom
nakul-krishnakumar:ml-algorithms-enum
Open

feat: add ml/base/kmeans/algorithms#10796
nakul-krishnakumar wants to merge 7 commits intostdlib-js:developfrom
nakul-krishnakumar:ml-algorithms-enum

Conversation

@nakul-krishnakumar
Copy link
Copy Markdown
Member

Resolves None.

Description

What is the purpose of this pull request?

This pull request:

  • Adds enum ml/cluster/base/kmeans/algorithms.

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

None.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Mar 7, 2026
@nakul-krishnakumar nakul-krishnakumar marked this pull request as draft March 7, 2026 06:35
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Mar 7, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Mar 7, 2026

Coverage Report

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

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

@nakul-krishnakumar nakul-krishnakumar changed the title feat: add enum ml/cluster/base/kmeans/algorithms feat: add enum ml/base/cluster/kmeans/algorithms Mar 8, 2026
---
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: 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
---
Comment thread lib/node_modules/@stdlib/ml/base/cluster/kmeans/algorithms/docs/repl.txt Outdated
Co-authored-by: Nakul Krishnakumar <nakulkrishnakumar86@gmail.com>
Signed-off-by: Nakul Krishnakumar <nakulkrishnakumar86@gmail.com>
---
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: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - 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: na
  - task: lint_license_headers
    status: passed
---
@nakul-krishnakumar nakul-krishnakumar marked this pull request as ready for review May 6, 2026 08:24
@nakul-krishnakumar nakul-krishnakumar requested a review from a team May 6, 2026 08:24
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label May 6, 2026
var contains = require( '@stdlib/array/base/assert/contains' ).factory;
var algorithms = require( './../lib' );

var isAlternative = contains( algorithms() );
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.

I believe you want isAlgorithm here and below.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oops, my bad.

// TypeScript Version: 4.1

/**
* Returns a list of clustering algorithms.
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.

Suggested change
* Returns a list of clustering algorithms.
* Returns a list of k-means clustering algorithms.

@@ -0,0 +1,22 @@

{{alias}}()
Returns a list of kmeans clustering algorithms.
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.

Suggested change
Returns a list of kmeans clustering algorithms.
Returns a list of k-means clustering algorithms.

k-means should be hyphenated wherever it is used in prose.

// MAIN //

/**
* Returns an object mapping supported KMeans clustering algorithms to integer values for purposes of C inter-operation.
Copy link
Copy Markdown
Member

@kgryte kgryte May 6, 2026

Choose a reason for hiding this comment

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

Suggested change
* Returns an object mapping supported KMeans clustering algorithms to integer values for purposes of C inter-operation.
* Returns an object mapping supported k-means clustering algorithms to integer values for purposes of C inter-operation.

Be consistent with spelling.

'use strict';

/**
* Return a list of KMeans clustering algorithms.
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.

Suggested change
* Return a list of KMeans clustering algorithms.
* Return a list of k-means clustering algorithms.

// MAIN //

/**
* Returns a list of KMeans clustering algorithms.
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.

Suggested change
* Returns a list of KMeans clustering algorithms.
* Returns a list of k-means clustering algorithms.

/**
* Returns a list of KMeans clustering algorithms.
*
* @returns {StringArray} list of clustering algorithms
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.

Suggested change
* @returns {StringArray} list of clustering algorithms
* @returns {Array<string>} list of clustering algorithms

We're slowly moving away from using StringArray to indicate Array<string>.

t.end();
});

tape( 'the function returns a list of kmeans clustering algorithms', function test( t ) {
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.

Suggested change
tape( 'the function returns a list of kmeans clustering algorithms', function test( t ) {
tape( 'the function returns a list of k-means clustering algorithms', function test( t ) {

{
"name": "@stdlib/ml/base/cluster/kmeans/algorithms",
"version": "0.0.0",
"description": "KMeans clustering algorithms.",
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.

Suggested change
"description": "KMeans clustering algorithms.",
"description": "k-means clustering algorithms.",


# Clustering Algorithms

> KMeans clustering algorithms.
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.

Suggested change
> KMeans clustering algorithms.
> k-means clustering algorithms.


#### algorithms()

Returns a list of KMeans clustering algorithms.
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.

Suggested change
Returns a list of KMeans clustering algorithms.
Returns a list of k-means clustering algorithms.

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.

Applies here and everywhere else.

Copy link
Copy Markdown
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

Left initial comments.

@kgryte kgryte added Feature Issue or pull request for adding a new feature. Machine Learning Issue or pull request specific to machine learning functionality. Needs Changes Pull request which needs changes before being merged. review: 3 and removed Needs Review A pull request which needs code review. labels May 6, 2026
---
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: 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
---
…eans/algorithms`

---
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
---
@nakul-krishnakumar
Copy link
Copy Markdown
Member Author

We had agreed on keeping a common namespace for all ML APIs rather than creating sub-namespaces like cluster/*, regression/* etc., and planned to move into the later in the future if required. So I have migrated ml/base/cluster/kmeans/algorithms to ml/base/kmeans/algorithms.
Ref: my gsoc proposal

@nakul-krishnakumar nakul-krishnakumar changed the title feat: add enum ml/base/cluster/kmeans/algorithms feat: add ml/base/kmeans/algorithms May 7, 2026
@nakul-krishnakumar nakul-krishnakumar requested a review from kgryte May 7, 2026 07:33
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label May 7, 2026
Comment thread lib/node_modules/@stdlib/ml/base/kmeans/algorithms/package.json Outdated
Signed-off-by: Nakul Krishnakumar <nakulkrishnakumar86@gmail.com>
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. Machine Learning Issue or pull request specific to machine learning functionality. Needs Changes Pull request which needs changes before being merged. Needs Review A pull request which needs code review. review: 3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants