问题描述
有没有人知道Java中的科学/数学库可以直接实现加权线性回归?一个函数行的东西,它接受3个参数并返回相应的系数:
Does anyone know of a scientific/mathematical library in Java that has a straightforward implementation of weighted linear regression? Something along the lines of a function that takes 3 arguments and returns the corresponding coefficients:
linearRegression(x,y,weights)
这看起来相当简单,所以我想它存在于某个地方。
This seems fairly straightforward, so I imagine it exists somewhere.
PS)我试过Flannigan的图书馆:,它有正确的想法,但似乎偶尔崩溃并抱怨我的自由度?
PS) I've tried Flannigan's library: http://www.ee.ucl.ac.uk/~mflanaga/java/Regression.html, it has the right idea but seems to crash sporadically and complain out my degrees of freedom?
推荐答案
不是库,但代码已发布:
(包括代码的数学解释,这是一个巨大的优势)。
此外,似乎这里有另一种相同算法的实现:
Not a library, but the code is posted: http://www.codeproject.com/KB/recipes/LinReg.aspx(and includes the mathematical explanation for the code, which is a huge plus).Also, it seems that there is another implementation of the same algorithm here: http://sin-memories.blogspot.com/2009/04/weighted-linear-regression-in-java-and.html
最后,来自新西兰大学的一个lib似乎已经实现了:(相当不错的javadocs)。具体方法如下所述:
Finally, there is a lib from a University in New Zealand that seems to have it implemented: http://www.cs.waikato.ac.nz/~ml/weka/ (pretty decent javadocs). The specific method is described here:http://weka.sourceforge.net/doc/weka/classifiers/functions/LinearRegression.html
这篇关于Java中的加权线性回归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!