Least Squares C# library [closed]

孤街浪徒 提交于 2019-12-17 19:32:57

问题


I am looking to perform a polynomial least squares regression and am looking for a C# library to do the calculations for me.

I pass in the data points and the degree of polynomal (2nd order, 3rd order, etc) and it returns either the C0, C1, C2 etc. constant values or the calculated values "predictions".

Note: I am using Least Squares to create some forecasting reports for disk usage, database size and table size.


回答1:


Here is a link for C# code on to do exactly this: http://www.trentfguidry.net/post/2009/08/01/Linear-Regression-of-Polynomial-Coefficients.aspx

Good luck!

Edit: Apparently the above link is broken. I made another solution awhile back: http://procbits.com/2011/05/02/linear-regression-in-c-sharp-least-squares/




回答2:


In the general case you want an "optimizer" or "mimimizer". See http://en.wikipedia.org/wiki/Optimization_(mathematics)#Solvers for some exmples. I see that the first link (http://en.wikipedia.org/wiki/IMSL_Numerical_Libraries) claims to have c# support.


Edit: For the limited use that you propose (linear or quadratic polynomials), you could just go to any copy of Numerical Recipies, grab a straight ahead implementation, and translate to your language. A general minimizer is overkill.

But note, also, that polynomials may be poor predictors.




回答3:


You can check library form ALGLIB under GPL licence 2.0. They have source code for C#, C++,...

http://www.alglib.net/interpolation/leastsquares.php




回答4:


You may want to check out alglib. It is in C++ instead of C#, but you might be able to write a wrapper over it.



来源:https://stackoverflow.com/questions/350852/least-squares-c-sharp-library

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!