Commit 2a68bec
committed
Fix multivariate default n.best to scale with observations, not features
The default n.best in nns_m_reg used floor((1-dependence)*sqrt(ncol)),
mirroring R's Multivariate_Regression.R:129 where n is shadowed by
ncol(original.IVs). With sqrt(#features) <= 2.24 for typical widths,
the default collapsed to n.best = 1 for any dependence above ~0.1,
making order=None predictions identical to order="max" (pure 1-NN) on
continuous multivariate data.
Use sqrt(nrow) instead, consistent with the sqrt(n_obs) grid nns_stack
already cross-validates over. Verified against a live patched R NNS
13.1 build on shared data: order=None now differs from order="max"
identically in both languages (59/60 test rows bit-exact, remaining row
is the out-of-support gradient-extension path). Full test suite passes;
no recorded R-parity case is affected because all cached multivariate
fixtures resolve to n.best = 1 under both formulas.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BPbZvtDw4h2XJo9w5hw57h1 parent 1196e98 commit 2a68bec
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| |||
0 commit comments