线性最小二乘拟合约束 - 有什么想法吗?
我遇到一个问题,我使用线性最小二乘法将高阶多项式拟合到(不是非常)噪声数据。目前,我使用的是 15 - 25 左右的多项式阶次,其效果出奇地好:依赖性非常接近线性,但“非常接近”建模的准确性至关重要。我正在使用 Matlab 的 polyfit() 函数,并且(显然)对 x 数据进行标准化。这通常工作得很好,但我遇到了一些最近的数据集的问题。拟合多项式在 x 数据区间内具有极值。对于我正在开发的应用程序来说,这是不可能的。多项式模型在 x 区间上必须没有驻点。
因此,我需要向最小二乘问题添加一个约束:拟合多项式的导数在已知的 x 范围内必须严格为正(或严格为负 - 这取决于数据,但简单的线性拟合将很快告诉我哪个是的。)我已经快速浏览了可用的优化工具箱功能,但我承认我不知道如何去做。有人有什么建议吗?
[我很高兴对于这些数据可能有比多项式更好的模型,但在短期内改变模型的形式是不可行的]
[结束语:我终于得到了替换这个可怕的多项式的许可模型!我将采用非参数方法,即样条平滑,使用优秀的 SPLINEFIT 乔纳斯·朗格伦的代码。这样做的优点是我已经在最终用户应用程序中使用样条模型,因此我已经有可用于评估样条模型的 C# 代码]
I have a problem where I am fitting a high-order polynomial to (not very) noisy data using linear least squares. Currently I'm using polynomial orders around 15 - 25, which work surprisingly well: The dependence is very nearly linear, but the accuracy of modelling the 'very nearly' is critical. I'm using Matlab's polyfit() function, and (obviously) normalising the x-data. This generally works fine, but I have come across an issue with some recent datasets. The fitted polynomial has extrema within the x-data interval. For the application I'm working on this is a non-no. The polynomial model must have no stationary points over the x-interval.
So I need to add a constraint to the least-squares problem: the derivative of the fitted polynomial must be strictly positive over a known x-range (or strictly negative - this depends on the data but a simple linear fit will quickly tell me which it is.) I have had a quick look at the available optimisation toolbox functions, but I admit I'm at a loss to know how to go about this. Does anyone have any suggestions?
[I appreciate there are probably better models than polynomials for this data, but in the short term it isn't feasible to change the form of the model]
[A closing note: I have finally got the go-ahead to replace this awful polynomial model! I am going to adopt a nonparametric approach, spline smoothing, using the excellent SPLINEFIT code by Jonas Lundgren. This has the advantage that I'm already using a spline model in the end-user application, so I already have C# code available to evaluate a spline model]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 cftool 并使用排除数据点选项。
You could use cftool and use the exclude data points option.