Re: [Math] How to do Polynomial Regression ?

2018-03-12 Thread Phil Steitz
On 3/12/18 10:15 AM, Debraj Manna wrote:
> Crossposting from stackoverflow
> 
> as I did not get any reply there
>
> Can someone let me know how I can do Polynomial Regression with Apache Maths
>  3.6.1
> ?
>
> Below are the data points I used for my testing
>
> 60735214881.391304  152025480.0060697824142.469570
> 152025840.0060651182200.208694
> 152026200.0060684367132.939130
> 152026560.0060676588613.008700
> 152026920.0060641816564.869570
> 152027280.0060604714824.233510
> 152027640.0060580042814.330440
> 152028000.0060536134542.469570
> 152028360.0060566323732.034780
> 152028720.0060578775249.252174
> 152029080.0060547382844.104350
> 152029440.0060536776546.802160
> 152029800.0060474342718.330440
> 152030160.0060452725477.286960
> 152030520.0060486821569.669560
> 152030880.0060247997139.995674
> 152031240.0060248432181.426090
> 152031600.0060217476247.373920
> 152031960.0060170744493.634780  152032320.00
>
> My code looks like below
>
> private void polynomialFitter(List pointlist) {
> final PolynomialCurveFitter fitter = PolynomialCurveFitter.create(2);
> final WeightedObservedPoints obs = new WeightedObservedPoints();
> for (List point : pointlist) {
> obs.add(point.get(1), point.get(0));
> }
> double[] fit = fitter.fit(obs.toList());
> System.out.printf("\nCoefficient %f, %f, %f", fit[0], fit[1], fit[2]);
> }
>
> The coefficients are reported as
>
> Coefficient 12.910025, 0.00, 0.00
>
> But these does not seem to be quite correct. If I use the same dataset
> in Online
> Polynimal Regression  and
> in archanoid online regression  - both
> reports same value as 654623237474.68250993904929103762,
> 28.75921919628759991574, -0.023885199278
>
> Can someone let me know what is going wrong? I have seen this question
> 
>  but that is not helping me?

Polynomial regression is not the same as curve fitting.  To do
polynomial regression in Commons Math, use the
OLSMultipleLinearRegression class, using, X, X^2 etc as the
independent variables (as your second reference above shows).

Phil




>
> Thanks,
>


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[Math] How to do Polynomial Regression ?

2018-03-12 Thread Debraj Manna
Crossposting from stackoverflow

as I did not get any reply there

Can someone let me know how I can do Polynomial Regression with Apache Maths
 3.6.1
?

Below are the data points I used for my testing

60735214881.391304  152025480.0060697824142.469570
152025840.0060651182200.208694
152026200.0060684367132.939130
152026560.0060676588613.008700
152026920.0060641816564.869570
152027280.0060604714824.233510
152027640.0060580042814.330440
152028000.0060536134542.469570
152028360.0060566323732.034780
152028720.0060578775249.252174
152029080.0060547382844.104350
152029440.0060536776546.802160
152029800.0060474342718.330440
152030160.0060452725477.286960
152030520.0060486821569.669560
152030880.0060247997139.995674
152031240.0060248432181.426090
152031600.0060217476247.373920
152031960.0060170744493.634780  152032320.00

My code looks like below

private void polynomialFitter(List pointlist) {
final PolynomialCurveFitter fitter = PolynomialCurveFitter.create(2);
final WeightedObservedPoints obs = new WeightedObservedPoints();
for (List point : pointlist) {
obs.add(point.get(1), point.get(0));
}
double[] fit = fitter.fit(obs.toList());
System.out.printf("\nCoefficient %f, %f, %f", fit[0], fit[1], fit[2]);
}

The coefficients are reported as

Coefficient 12.910025, 0.00, 0.00

But these does not seem to be quite correct. If I use the same dataset
in Online
Polynimal Regression  and
in archanoid online regression  - both
reports same value as 654623237474.68250993904929103762,
28.75921919628759991574, -0.023885199278

Can someone let me know what is going wrong? I have seen this question

 but that is not helping me?

Thanks,


Re: [ANNOUNCE] Commons Parent 44 released.

2018-03-12 Thread Rob Tompkins
Blarg….I’m going to have to do a 45, because the GPG plugin isn’t in the 
correct location relative to the release plugin in the parent. I’ll start 
working on that.

-Rob

> On Mar 12, 2018, at 7:57 AM, Rob Tompkins  wrote:
> 
> Hello All,
> 
> Commons Parent 44 has been released.
> 
> The changes from release 43 are:
> 
> - new profile module-name to add 'Automatic-Module-Name' entry to the 
> manifest
> - felix:maven-bundle-plugin 3.4.0 -> 3.5.0.
> - build artifacts -test.jar, -sources.jar and -test-sources.jar always, 
> not only at release time
> - maven-enforcer-plugin set version to 3.0.0-M1 and update Maven 
> requirement from 3.0.0 to 3.0.5 (the latest 3.0.x.)
> - jacoco-maven-plugin 0.7.9 -> 0.8.0.
> - Fix japicmp config: add to reporting section and define 
> ignoreMissingNewVersion explicitly
> - org.apache:apache 18 -> 19
> - add commons-release-plugin:1.1
> - add spotbugs-maven-plugin: 3.1.3
> - maven-surefire-plugin 2.20.1 -> 2.21.0
> - maven-failsafe-plugin 2.20.1 -> 2.21.0
> 
> Note, the inclusion of the release plugin, means that (for a non multi module 
> build), you will want to add the following two properties to your pom:
> 
> commons.release.isDistModule=true
> commons.distSvnStagingUrl=https://dist.apache.org/repos/dist/dev/commons/foo 
>  (for component foo).
> 
> Then for a release when you build, you run:
> 
>   mvn -Duser.name= -Prelease -Ptest-deploy clean test 
> site deploy
> 
> for a test deployment, and:
> 
> mvn -Duser.name= -Prelease clean test site deploy
> 
> for an actual deployment. To see the artifacts being staged properly, look 
> under “./target/commons-release-plugin/scm” as that is what should end up 
> checked into the dev distribution location.
> 
> Note, also that I plan to add the above notes, with more detail to the 
> preparing a release page, and the commons-parent page on the main site. I 
> simply wanted to give directions if anyone was particularly anxious to use 
> the plugin/parent immediately.
> 
> 
> Cheers,
> -Rob
> 



[ANNOUNCE] Commons Parent 44 released.

2018-03-12 Thread Rob Tompkins
Hello All,

Commons Parent 44 has been released.

The changes from release 43 are:

- new profile module-name to add 'Automatic-Module-Name' entry to the 
manifest
- felix:maven-bundle-plugin 3.4.0 -> 3.5.0.
- build artifacts -test.jar, -sources.jar and -test-sources.jar always, not 
only at release time
- maven-enforcer-plugin set version to 3.0.0-M1 and update Maven 
requirement from 3.0.0 to 3.0.5 (the latest 3.0.x.)
- jacoco-maven-plugin 0.7.9 -> 0.8.0.
- Fix japicmp config: add to reporting section and define 
ignoreMissingNewVersion explicitly
- org.apache:apache 18 -> 19
- add commons-release-plugin:1.1
- add spotbugs-maven-plugin: 3.1.3
- maven-surefire-plugin 2.20.1 -> 2.21.0
- maven-failsafe-plugin 2.20.1 -> 2.21.0

Note, the inclusion of the release plugin, means that (for a non multi module 
build), you will want to add the following two properties to your pom:

commons.release.isDistModule=true
commons.distSvnStagingUrl=https://dist.apache.org/repos/dist/dev/commons/foo 
 (for component foo).

Then for a release when you build, you run:

mvn -Duser.name= -Prelease -Ptest-deploy clean test 
site deploy

for a test deployment, and:

mvn -Duser.name= -Prelease clean test site deploy

for an actual deployment. To see the artifacts being staged properly, look 
under “./target/commons-release-plugin/scm” as that is what should end up 
checked into the dev distribution location.

Note, also that I plan to add the above notes, with more detail to the 
preparing a release page, and the commons-parent page on the main site. I 
simply wanted to give directions if anyone was particularly anxious to use the 
plugin/parent immediately.


Cheers,
-Rob