Repository navigation
Delete the unused legacy regression engine and dead helpers - #156
Closed
gitRasheed wants to merge 5 commits into
Closed
gitRasheed wants to merge 5 commits into
gitRasheed wants to merge 5 commits into
Conversation
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
force-pushed
the
rasheed/pandas-names-levels
branch
from
November 2, 2026 23:09
c5c8df6 to
f1c17a3
Compare
gitRasheed
force-pushed
the
rasheed/remove-dead-code
branch
from
November 2, 2026 23:09
1b8b8ed to
e51a646
Compare
Contributor
|
Incorporated through NNS R 14.0 integration #192, merged as |
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.
regression.py,multivariate_regression.pyandsmoothing.pystill carried the regression engine thatnns._reg_enginereplaced, 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
nns.smoothingmodule, whose spline adapter only the legacy code imported. The publicnns_reg,prepare_factor_predictors, the result types and_r2stay.nns_reg_mvbinding, 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-levelnns.*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.reggives 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.