#ifndef LOWESS_SMOOTHER_H #define LOWESS_SMOOTHER_H #include #include #include #include // lowess namespace Lowess { // 配置参数结构体 struct Config { double smoothingFactor = 0.25; int robustnessIterations = 3; }; // 验证参数有效性 void validateConfig(const Config& config); // 三次权重函数 double weightFunction(double x); // 计算中位数绝对偏差 double medianAbsoluteDeviation(const std::vector& residuals); // 计算带宽 std::vector computeBandwidths(const std::vector& x, double smoothingFactor); // 核心平滑函数 std::vector smooth( const std::vector& x, const std::vector& y, const Config& config = Config() ); } // namespace Lowess #endif // LOWESS_SMOOTHER_H