Hi.
>
> I was looking forward to use apache math, but I have found a serious
> limitation in apache-math2x and apache-math3x ; which have stopped me from
> using apache math, according to me it is very important aspect and should
> have been there, or I am missing something.
>
> When we do linear regression (SimpleRegression) it generates a line
> equation( for example: y =3x+7 ) how can i be able to access this equation
> in string format. so that end user can understand how the apache math is
> working internally. This way I can persist it into db or file and read it
> back into SimpleRegression object.
>
> According to me this is a very basic feature and should have been there in
> apache-commons-math package, I am sure I am missing something.
Maybe I'm missing something but I don't see that string output is a basic
feature.
And I don't see the link between the string representation and
"[understanding] how apache math is working internally".
> Can any body help me; how my above requirement could be achieved ?
The accessors are available; so, to get a "String" representation, something
along the following lines should work (not tested):
---
SimpleRegession r = new SimpleRegession(true);
// ... Add data ...
String s = "y = "
+ r.getSlope() + " x + "
+ r.getIntercept();
---
[Also, I would not save a string to a DB when 2 numbers would be
sufficient.]
Then, there is the issue of reading back slope and intercept and create a
"SimpleRegression" object. I understand this a s request to have additional
constructors:
---
public SimpleRegression(double slope) {
// ...
}
public SimpleRegression(double slope, double intercept) {
// ...
}
---
With those you could add new observations without needing to persist the
"old" ones but only the last computed slope and intercept values.
Do I understand correctly?
Regards,
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]