Repository navigation
fix(vutils): stabilize regression fits and add paired bootstrap - #291
Merged
Merged
Conversation
666haiwen
approved these changes
Oct 9, 2026
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.
🤔 这个分支是...
🔗 相关 issue 连接
暂无独立 issue。
💡 问题的背景&解决方案
现有线性/多项式回归在 x 有大偏移时可能返回错误的斜率或零预测,LOWESS 的 predict 与 evaluateGrid 没有使用同一份稳健拟合状态。使用原始样本生成回归曲线和残差时,两条路径因此会得到不同模型。
📝 Changelog
行为调整: LOWESS 默认 span 从 0.3 改为 2/3,iterations 从 2 改为 3;取消默认 1000 样本截断及按 N 自动减少迭代。默认使用全量观测,精确路径存在 O(N²) 成本;大样本可显式选择 delta,maxSamples 的显式用途继续保留。稳健拟合在模型构建时完成,旧曲线和退化预测可能改变。不可表示的系数/结果和没有有效局部观测会明确报错。
既有 confidenceInterval API 保留;本 PR 没有将旧多项式/LOWESS 区间近似声称为新的 bootstrap CI,也没有修改包版本或执行发布。详细契约和迁移影响见 packages/vutils/REGRESSION.md,文档随 npm 包打包。
☑️ 自测
验证使用 Node.js 22.23.3,基于最新 origin/main(5939197):
此前并行单测运行中 LOWESS 墙钟预算断言失败;串行执行后,本地 Node.js 22.23.3 和 20.19.4 的 53 套 / 276 项均通过。提交 ee963ab 的 GitHub 单测任务 已通过:四个包合计 101 套 / 816 项,包含全部 LOWESS 性能预算断言;未跳过测试或放宽阈值。
GitHub 验证限制: Labeler 使用 pull_request_target,读取 main 的工作流与配置,合并前该 PR 的标签检查仍可能因旧配置失败。
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough