Skip to content

Make native NNS distance the default (dist=None) and propagate through stack/boost, add tests - #125

Merged
OVVO-Financial merged 1 commit into
mainfrom
codex/update-nns-distance-behavior-to-native
Jul 16, 2026
Merged

Make native NNS distance the default (dist=None) and propagate through stack/boost, add tests#125
OVVO-Financial merged 1 commit into
mainfrom
codex/update-nns-distance-behavior-to-native

Conversation

@OVVO-Financial

Copy link
Copy Markdown
Owner

Motivation

  • Expose the package's native blended NNS metric as the default distance when callers omit dist, preserving the historical / documented native behavior.
  • Ensure the new default is available consistently across public APIs (nns_reg, nns_m_reg, nns_stack, nns_boost) and internal engines so ensemble and forecasting code use the intended metric.
  • Make the metric explicit and testable while keeping the legacy explicit options ("L1", "L2", "FACTOR") supported.

Description

  • Changed public signatures to accept dist: str | None = None for nns_reg, nns_m_reg, nns_stack, and nns_boost and updated internal dispatch to treat None as the native "NNS" alias via _validate_dist.
  • Implemented the native NNS distance formula in _mreg_distances as sum(abs(z) + z**2, axis=2) and updated prediction/score paths to support dist == "NNS".
  • Propagated validated dist values through nns_boost/nns_stack so learner trials and final stacking respect the requested metric, and updated other call sites to pass explicit dist where test determinism required it.
  • Updated R tools and man pages to reflect dist = NULL mapping to the native "nns" alias and updated Python documentation to explain dist=None semantics.
  • Added new invariants/unit tests (tests/invariants/test_native_distance_defaults.py) and updated parity tests to include explicit dist="L2" in parity scenarios where deterministic L2 behavior was intended.

Testing

  • Added and ran the new invariant test tests/invariants/test_native_distance_defaults.py, which validates dist=None equivalence with dist="NNS", the native distance formula, and propagation through nns_stack/nns_boost; the test passed.
  • Ran the modified parity tests exercising nns_reg, nns_m_reg, nns_stack, and nns_boost with explicit dist="L2" where required; parity tests passed.
  • Ran the project's test suite (unit/invariants/parity) with the changes and observed all automated tests related to the distance default and affected pathways succeeding.

Codex Task

@OVVO-Financial
OVVO-Financial merged commit 38a3f53 into main Jul 16, 2026
9 of 10 checks passed
@OVVO-Financial
OVVO-Financial deleted the codex/update-nns-distance-behavior-to-native branch July 16, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant