feat(math): Q11 — replicate vectorz distance cancellation in legacy kmeans#2654
Draft
jucor wants to merge 1 commit into
Draft
feat(math): Q11 — replicate vectorz distance cancellation in legacy kmeans#2654jucor wants to merge 1 commit into
jucor wants to merge 1 commit into
Conversation
This was referenced Jul 22, 2026
Draft
Draft
docs(delphi): R1-parity goal docs, journal (2026-07-18 → 07-22 s3), quirks + divergence ledger
#2626
Draft
…means Clojure's kmeans distances go through vectorz's matrix/distance on ArraySubVector row views, which computes d^2 = |a|^2+|b|^2-2ab; the cancellation floors true distances below ~1e-8 to EXACTLY 0.0, so near-coincident points TIE against multiple clusters and min-key's last-wins tie-break merges them into the LATER cluster (the emptied one drops). Verified in-process on the vw every-vote step-57 pair (true distance 4.66e-15 -> both cluster distances 0.0 -> merge), via the new cache-safe diagnostic math/dev/proj_probe.clj, which also reproduces the recording chain bit-exactly. CLOJURE_QUIRKS.md Q11. _euclidean in legacy_kmeans.py now uses the same formula (module runs only in clojure-legacy mode — gated by construction). numpy reproduces the 0.0 collapse bit-for-bit on the real pair. The pre-Q11 all-singletons expectation in test_base_cluster_lineage.py pinned python's old diff-based distance, not Clojure — updated to the verified contract (merges only ever at Q11-distance 0.0). TDD: RED on the real step-57 pair (unit + warm-start merge integration). commit-id:7ae9c688
Delphi Coverage Report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clojure's kmeans distances go through vectorz's matrix/distance on
ArraySubVector row views, which computes d^2 = |a|^2+|b|^2-2ab; the
cancellation floors true distances below ~1e-8 to EXACTLY 0.0, so
near-coincident points TIE against multiple clusters and min-key's
last-wins tie-break merges them into the LATER cluster (the emptied one
drops). Verified in-process on the vw every-vote step-57 pair (true
distance 4.66e-15 -> both cluster distances 0.0 -> merge), via the new
cache-safe diagnostic math/dev/proj_probe.clj, which also reproduces the
recording chain bit-exactly. CLOJURE_QUIRKS.md Q11.
_euclidean in legacy_kmeans.py now uses the same formula (module runs
only in clojure-legacy mode — gated by construction). numpy reproduces
the 0.0 collapse bit-for-bit on the real pair. The pre-Q11
all-singletons expectation in test_base_cluster_lineage.py pinned
python's old diff-based distance, not Clojure — updated to the verified
contract (merges only ever at Q11-distance 0.0).
TDD: RED on the real step-57 pair (unit + warm-start merge integration).
commit-id:7ae9c688
Stack: