Skip to content

Sync partial moments, targets and dominance to R NNS 14.2 - #203

Closed
gitRasheed wants to merge 6 commits into
automation/r-cache-nns-14.2from
rasheed/r142-sync
Closed

gitRasheed wants to merge 6 commits into
automation/r-cache-nns-14.2from
rasheed/r142-sync

Conversation

@gitRasheed

@gitRasheed gitRasheed commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

I'm targeting the cache-refresh branch of #201 (b184171c) and syncing Python to R NNS 14.2 at 31291970.

  • LPM and UPM use the mean for a None target. With excess returns, lpm(1, None, [1, 2, 3, 10], True) returns 1.5. A nonfinite target raises before a bad degree.
  • Ratios and bivariate co-moments reject character targets. Numeric targets can include Decimal. A date counts days. NumPy datetimes and pandas timestamps keep their unit, so a target two seconds after the epoch gives lpm_ratio of 0.5 for degree 1 and data [0, 2, 4].
  • pm_matrix accepts "mean" and "means" for column means, including a one-element Series with index 0. It reads matrix targets by column. For four columns, [[1, 3], [2, 4]] supplies 1, 2, 3, 4.
  • Scalar moments, ratios, bivariate co-moments, CDF, VaR and pairwise dominance reject categorical vectors. VaR, PM matrices, CDF, nD moments and SD efficient-set searches reject categorical columns. This includes the search inside SD clustering.
  • The nD moments reject negative and NaN degrees. A normalized nD moment or matrix cell with zero total uses its degree-zero share. With all observations and targets equal to 1, the lower share is 1 and joint survival is 0 because it excludes ties.
  • Discrete unidirectional FSD accepts infinity. For [0, inf] against [0, 1] it returns 1. Continuous FSD, SSD and TSD reject infinity.

I kept Python's documented scalar broadcast in pm_matrix. A target of 0 applies to every column. R NNS 14.0 and 14.2 both reject a single numeric target for multiple columns.

I compared 4,438 native calls and 4,390 NumPy calls with live R and found zero regressions against #201. CI needs #202 to go green.

@OVVO-Financial
OVVO-Financial force-pushed the automation/r-cache-nns-14.2 branch 4 times, most recently from 6c37081 to bb05d3d Compare November 21, 2026 13:21
OVVO-Financial pushed a commit that referenced this pull request Nov 21, 2026
…ns-r14-parity-fidelity-rgag0e

#200 and #203 both added src/nns/_r14_partial_moments.cpp: #200's is the
vendor partial-moment overlay with the D.UPM fix, #203's the R 14.2
normalisation helpers for the nD moments and PM.matrix. #200's keeps the
name; #203's becomes src/nns/_r14_pm_norm.{cpp,hpp}.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wws6NpuQ72C5sfEYVoVmGt
OVVO-Financial pushed a commit that referenced this pull request Nov 21, 2026
…-14.2

The builder's regeneration (bb05d3d) and this branch's agree on every shared
cache entry. This branch's cache adds the entries for tests the builder's run
did not have (the merged #203 tests, the meboot helpers and the new 14.2
contracts), so the resolution keeps this branch's tree unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wws6NpuQ72C5sfEYVoVmGt
OVVO-Financial pushed a commit that referenced this pull request Nov 21, 2026
- r_commit f0387ed and NNS_14.2.tar.gz as stored there (sha256 a4e04b26...),
  the archive the cache builder downloads; its R/ and src/ files equal the
  Git tree apart from CRLF line endings and final newlines.
- The central-tendency and M.reg prediction overlays now port f0387ed's
  sources. The dependence and D.UPM overlays keep their source commits: R
  14.2 changes those files only in label ordering and the zero-total rule.
- #203's normalisation helper is tracked under its new name,
  src/nns/_r14_pm_norm.cpp, beside #200's D.UPM overlay, so there are six
  overlays, all verified against f0387ed.
- Cache summary: 150 shards, 3124 entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wws6NpuQ72C5sfEYVoVmGt

Copy link
Copy Markdown
Owner

Closing as superseded. All six commits on this branch, from cc2bbee to 7a2ddd7, are on main through #204 (merge commit 56410bd), which merged them together with the R NNS 14.2 port. The conflicts shown here are only against the old base automation/r-cache-nns-14.2, the builder's branch from #201, which is merged too. There is nothing left to resolve.

The normalisation helper is on main as src/nns/_r14_pm_norm.cpp and .hpp. It was renamed so it can sit beside the D.UPM overlay from #200, and the manifest tracks it as its own overlay. The 14.2 live sweeps (scripts/live_parity/) cover the partial-moment, target and dominance rules from this PR, and they match R exactly with and without the native extension.


Generated by Claude Code

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