Skip to content

Conversation

@nakul-krishnakumar
Copy link
Member


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: passed
  • 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 ---

Resolves None.

Description

What is the purpose of this pull request?

This pull request:

  • Adds ml/incr/lvq.

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

To understand the algorithm and API design, I consulted ChatGPT, but the proposed changes were fully authored manually by myself.


@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: na
  - task: lint_package_json
    status: passed
  - 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: 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
---
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 13, 2025
@nakul-krishnakumar nakul-krishnakumar changed the title [WIP]: add ml/incr/lvq feat: add ml/incr/lvq Dec 13, 2025
@nakul-krishnakumar
Copy link
Member Author

Converting this to draft as the implementation is not yet finished.

@nakul-krishnakumar nakul-krishnakumar marked this pull request as draft December 13, 2025 22:10
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Dec 13, 2025
@nakul-krishnakumar
Copy link
Member Author

As discussed with @kgryte in the previous office hour, I am opening this WIP PR for ongoing development. A few things to note:

  1. The main algorithm implementation is nearly complete, with a few patches still pending.
  2. The primary reference is the base paper ( The Self-Organizing Map, Teuvo Kohonen 1990 ), but note that it only states the batch algorithm where as this PR is regarding incr/lvq.
  3. I will continue adding the remaining components of the package as they are completed.

---
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: 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: na
  - task: lint_license_headers
    status: passed
---
@nakul-krishnakumar
Copy link
Member Author

ml_incr_lvq(1)
By referring to the paper and trying out various possibilities, this is the API Design for the incrlvq() function I could come up with. (Above design does not cover accumulator and predict)

@nakul-krishnakumar
Copy link
Member Author

nakul-krishnakumar commented Dec 15, 2025

Also, below are some confusions I have:

  • Should the Result object have a stats matrix which contains the prototype statistics just like how ml/incr/kmeans does? ml/incr/kmean/accumulator
  • Should I add other distance metrics like dot product?
  • Above API Design assumes that the algorithm will handle new labels. When new labels come, the accumulator identifies it and then add the current input feature vector as a prototype under that class label.
    • Why this behaviour?
      • Because in the official batch algorithm implementation, it allows a type of prototype initialization where the first n (in our case, n = 1) input feature vectors under each class label are set as the prototypes for that class label. (Here, n means each class label can have n prototypes)
      • Current implementation assumes all classes to only have one prototype each, we could go ahead and make it more complex by allowing each class to have multiple prototypes.
    • We could also set a options.allowNewClasses options
      • IF False, THEN throw error when new class label occur.
      • IF True, THEN add the new class label into labels set.

I would really appreciate your opinion on the above! @kgryte :)

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.

2 participants