用于进行线性或非线性最小二乘近似的 Ruby 库?
是否有一个 Ruby 库允许我对一组数据进行线性或非线性最小二乘近似。
我想做的是:
- 给定一系列 [x,y] 数据点
- 针对该数据生成线性或非线性最小二乘近似
- 库不必弄清楚是否需要执行线性或非线性 最小二乘近似非线性近似。库的调用者应该知道他们需要什么类型的回归,
我不想尝试移植一些 C/C++/Java 库来获得此功能,所以我希望有一些现有的 Ruby 库可供我使用。
Is there a Ruby library that allows me to do either linear or non-linear least squares approximation of a set of data.
What I would like to do is the following:
- Given a series of [x,y] data points
- Generate a linear or non linear least squares approximation against that data
- The library doesn't have to figure out if it needs to do a linear or non linear approximation. The caller of the library should know what type of regression they need
I'd prefer not to have to try to port some C/C++/Java library to get this functionality so I'm hoping there is some existing Ruby lib that I can use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试使用“statsample”gem。您可以使用下面提供的示例执行对数、指数、幂或任何其他转换。我希望这有帮助。
Try using the 'statsample' gem. You can perform logarithmic, exponential, power, or any other transformation using the example that is provided below. I hope this helps.
我使用这个片段来计算一些回归。第一个参数是包含 x 坐标的数组,第二个参数是包含 y 坐标的数组,最后一个参数是要查找的多项式的次数。不确定这是否是您正在寻找的,但希望它有所帮助。
I used this snippet to work out some regressions. The first parameter is an array containing the x coordinates, the second an array containing the y coordinates and the last is the degree of the polynomial you are looking for. Not sure if it is this what you are looking for, but hopes it helps.
我正在维护一个用于非线性最小二乘最小化的 C 库, http://apps.jcns.fz -juelich.de/lmfit,附带 Ruby 的 swig 文件。
I am maintaining a C library for non-linear least squares minimization, http://apps.jcns.fz-juelich.de/lmfit, that comes with swig files for Ruby.