最小二乘中位数稳健回归 C++
Least Median of Squares robust regression C++
我有一组数据 z(0), z(1), z(2)...,z(n)
,我目前正在用 p(x,y) = a(1)*x^2+a(2)*y^2+a(3)*x*y+a(4)
类型的 2 变量多项式拟合。我有 i=1,...,n
(x(i),y(i))
坐标,我强加为 p(x(i),y(i))=z(i)
。通过这种方式,我得到了一个可以使用 Eigen SVD . I am looking for a more sophisticated method that can take care of outliers, like a Least Median of Squares robust regression (as described here) but I haven't found a C++ implementation for 2 variables. I looked in GSL but it seems there is nothing for 2 variable functions. The only other solution I can think of is using a TGraph2D in ROOT 求解的超定系统。你知道任何其他解决方案吗?也许是数字食谱?因为我正在编写 C++ 代码,所以我更喜欢 C 或 C++ 实现。
由于还没有给出答案,但我仍在努力解决这个问题,我会在这里分享我的进展。
class TLinearFitter 有一个拟合方法,允许您select 稳健拟合 - 最小二乘回归 (LTS):
https://root.cern.ch/root/html532/TLinearFitter.html
另一种可能的解决方案,可能更耗时,但可能更高效长运行是写我自己的函数来最小化,并使用:
https://projects.coin-or.org/Ipopt 将其最小化。虽然在这种方法中有一个更大的"step"。我不知道如何使用这个库,我还没有(还?)找到一个很好的教程来理解它。
此处:https://wis.kuleuven.be/stat/robust/software LMedS 算法有一个 Fortran 实现,称为 PROGRESS。因此,另一种可能的解决方案是将此软件移植到 C/C++ 并从中创建一个库。
我有一组数据 z(0), z(1), z(2)...,z(n)
,我目前正在用 p(x,y) = a(1)*x^2+a(2)*y^2+a(3)*x*y+a(4)
类型的 2 变量多项式拟合。我有 i=1,...,n
(x(i),y(i))
坐标,我强加为 p(x(i),y(i))=z(i)
。通过这种方式,我得到了一个可以使用 Eigen SVD . I am looking for a more sophisticated method that can take care of outliers, like a Least Median of Squares robust regression (as described here) but I haven't found a C++ implementation for 2 variables. I looked in GSL but it seems there is nothing for 2 variable functions. The only other solution I can think of is using a TGraph2D in ROOT 求解的超定系统。你知道任何其他解决方案吗?也许是数字食谱?因为我正在编写 C++ 代码,所以我更喜欢 C 或 C++ 实现。
由于还没有给出答案,但我仍在努力解决这个问题,我会在这里分享我的进展。
class TLinearFitter 有一个拟合方法,允许您select 稳健拟合 - 最小二乘回归 (LTS):
https://root.cern.ch/root/html532/TLinearFitter.html
另一种可能的解决方案,可能更耗时,但可能更高效长运行是写我自己的函数来最小化,并使用: https://projects.coin-or.org/Ipopt 将其最小化。虽然在这种方法中有一个更大的"step"。我不知道如何使用这个库,我还没有(还?)找到一个很好的教程来理解它。
此处:https://wis.kuleuven.be/stat/robust/software LMedS 算法有一个 Fortran 实现,称为 PROGRESS。因此,另一种可能的解决方案是将此软件移植到 C/C++ 并从中创建一个库。