Skip to content

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

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

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 2 times, most recently from 36332e2 to 8194bd3 Compare November 20, 2026 14:45

This branch has not been deployed

No deployments
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