Skip to content

Vendor NNS-core from the R-fixes follow-up and drop the M.reg underflow guard - #169

Closed
gitRasheed wants to merge 4 commits into
rasheed/mirror-regression-stackfrom
rasheed/vendor-core
Closed

gitRasheed wants to merge 4 commits into
rasheed/mirror-regression-stackfrom
rasheed/vendor-core

Conversation

@gitRasheed

@gitRasheed gitRasheed commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

We vendor extern/NNS-core from the tip of OVVO-Financial/NNS-core#34 and set core_commit to its full SHA. The snapshot brings the core ports of the later R fixes: the pairwise SD test, NNS.seas scoring every component series, equal ARMA seasonal weights when they sum to zero, and Rmath's factorisation of dt in the M.reg kernels.

Stacked on #168; merge with a merge commit.

Changes

Tests

The gate test is replaced by a native-only parity test against R's M.reg kernels, with new cache shards for both. The NumPy path differs from R by 1.2e-8 at one far L1 path entry (k = 167), through SciPy's t.pdf; that predates this slice. Native and NNS_DISABLE_NATIVE=1 runs of the parity, invariant, property, plotting and docs tests give the same results. The parity cache encodes R 13.3 plus the fixes in OVVO-Financial/NNS#73-#92.

Vendors OVVO-Financial/NNS-core#34

Update

This push re-vendors NNS-core at a0d3b93, the tip of OVVO-Financial/NNS-core#34. That adds the core mirrors of OVVO-Financial/NNS#102, #105 and #106, and parallel_for now passes a worker's exception back to the caller instead of aborting the process. The two strict xfails from #157 come off: native and fallback both give 20 on the M.reg tie case and 9.441176 on the mode tie case.

Review

GPT-6.1 Sol reviewed this slice and found nothing. It checked 168 M.reg cases and 56 vendored-kernel cases against live R; far queries match R to 1.85e-14.

Copy CMakeLists.txt, include/ and src/ from NNS-core's
core-r-fixes-followup tip (the git objects match it verbatim) and record
that commit as core_commit. Besides comment trims, the snapshot brings
the core ports of the later R fixes: the pairwise SD test, NNS.seas
scoring every component series, equal ARMA seasonal weights when they
sum to zero, and Rmath's factorisation of dt in the M.reg kernels.

NNS-python binds none of the SD or seasonality kernels, so their R
mirrors stay in Python; the M.reg dt change is picked up in the next
commit. Native and NNS_DISABLE_NATIVE=1 runs of the parity, invariant,
property, plotting and docs tests give the same results.
_native_mreg_is_exact kept queries far outside the training ranges on
the NumPy path, because NNS-core evaluated the Student-t weight as the
closed form (1 + d^2/k)^(-(k+1)/2), which underflows differently from
Rmath's dt. NNS-core now factors dt as Rmath does, so the native kernels
follow R there as well and the guard goes.

Far queries ([0.2, 0.5, 300], [5, -40, 0.3], [1e3, 0.5, 0.5]) on a
300-row RPM, dist NNS/L1/L2, k = 50 and 300 and the k <= 200 path:
native vs R's NNS_mreg_predict_v2_cpp / _path_v2_cpp, max relative
difference 3e-15. The gate test is replaced by this parity test (native
only: the NumPy path differs from R by 1.2e-8 at one far L1 path entry,
k = 167, through SciPy's t.pdf).
Copy CMakeLists.txt, include/ and src/ again from NNS-core's
core-r-fixes-followup tip and record it as core_commit. The new tip only
drops audit finding IDs from comments.
Copy CMakeLists.txt, include/ and src/ from NNS-core's core-r-fixes-followup
tip and record it as core_commit. It brings mreg_predict dividing by the
column range like R's reference helper, so native M.reg distance ties resolve
like the NumPy fallback; the SD pair test centred on its midrange; NNS.seas
constancy read from raw values with a stable CV order; single-mode averaging
of equally high peaks; and parallel_for rethrowing worker exceptions on the
calling thread. The two native/fallback tie checks that waited for this
snapshot lose their strict xfails.
@gitRasheed
gitRasheed force-pushed the rasheed/mirror-regression-stack branch from febf707 to bd3e248 Compare November 2, 2026 23:09
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Incorporated through NNS R 14.0 integration #192, merged as bd19c3303222af46da79d8c97f258248eb5674d2. Verified exact head 448c27ab559e33bea82c4b3ebf8301bb8da2d872 is an ancestor of main; original commits and authorship are preserved. The integration includes the subsequent R14 compatibility corrections and passed the complete GitHub Python 3.11-3.14 matrix. This supersedes the separate landing, not the work or review history.

@github-actions github-actions Bot closed this Nov 7, 2026
@github-actions
github-actions Bot deleted the rasheed/vendor-core branch November 7, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant