Skip to content

Delete the unused legacy regression engine and dead helpers - #156

Closed
gitRasheed wants to merge 5 commits into
rasheed/pandas-names-levelsfrom
rasheed/remove-dead-code
Closed

gitRasheed wants to merge 5 commits into
rasheed/pandas-names-levelsfrom
rasheed/remove-dead-code

Conversation

@gitRasheed

@gitRasheed gitRasheed commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

regression.py, multivariate_regression.py and smoothing.py still carried the regression engine that nns._reg_engine replaced, about 1650 lines that no test executed. It implemented different semantics, and an R-parity fix had already landed in one of these dead copies instead of the live one.

Stacked on #155; merge with a merge commit.

Changes

  • Remove the legacy univariate and multivariate engine, its interval and extrapolation helpers, and the nns.smoothing module, whose spline adapter only the legacy code imported. The public nns_reg, prepare_factor_predictors, the result types and _r2 stay.
  • Remove six helpers with no callers, and the nns_reg_mv binding, which only the legacy path reached.

No behaviour changes. Imports of the removed internal names, such as from nns.regression import nns_part, now fail; every top-level nns.* export is intact.

Tests

The full suite is unchanged (2573 passed). The M.reg property strategy now excludes subnormal floats: the pure-Python gravity bins divided by zero on a column whose only nonzero value is subnormal, and R's NNS.M.reg gives NA classes there. The parity cache encodes unpatched R 13.3.

See #147

Review

GPT-6.1 Sol reviewed this slice and found nothing. It checked the removed helpers for surviving callers and all 74 public exports.

nns.regression imports nns.smoothing, which imported scipy.interpolate at
module level: about 0.40 s of a 0.47 s 'import nns; nns.nns_reg'. Only
smooth=True needs BSpline, so import it on first use. Import plus nns_reg
attribute access now takes 0.14 s.
nns_reg has run through nns._reg_engine for a while, but regression.py still
carried the previous implementation (_nns_reg_legacy, the univariate core,
dimension reduction, interval and extrapolation helpers), multivariate_regression.py
its own RPM/prediction/interval helpers, and smoothing.py a spline adapter only
the legacy code imported. A full-suite coverage run executed none of it, and it
implemented different semantics (UPM.VaR intervals, another extrapolation
rule), so it invited fixes in the wrong place: an R-parity change had already
been applied to one of these dead copies.

Kept: the public nns_reg wrapper, prepare_factor_predictors and the helpers it
calls, result types and _r2. No behaviour change; full suite unchanged
(2573 passed).
_helpers._as_vector_or_matrix/_as_point_matrix/_as_flat_vector,
categorical._dense_factor_codes, stack._spearman_scores and
boost._column_is_numeric are referenced nowhere in src/ or tests/ and never ran
in a full-suite coverage run. No behaviour change.
nns_reg_mv re-ported the multivariate-call regression points of the legacy
nns.regression._nns_reg_univariate_core. That code is reachable only from the
legacy regression path being deleted. It hard-coded stn = 0.95 and
omitted R's single-row tripling. Nothing else uses it, and
nns.regression already falls back to its Python path when the symbol is
missing. No public result changes: the regression tests pass unchanged.
The pure-Python gravity bins divide by zero on a column whose only nonzero
value is subnormal, and R's NNS.M.reg gives NA classes there, so exclude
subnormals here as the regression strategy does.
@gitRasheed
gitRasheed force-pushed the rasheed/pandas-names-levels branch from c5c8df6 to f1c17a3 Compare November 2, 2026 23:09
@gitRasheed
gitRasheed force-pushed the rasheed/remove-dead-code branch from 1b8b8ed to e51a646 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 e51a6463b41f829b8c09fc6900b7d3127465ad14 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/remove-dead-code 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