You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2013/11/10 19:03:41 UTC
svn commit: r1540502 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
Author: psteitz
Date: Sun Nov 10 18:03:41 2013
New Revision: 1540502
URL: http://svn.apache.org/r1540502
Log:
Changed to use InsufficientDataException when the model does not contain sufficient data for the number of regerssors; fixed error in precondition statement.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java?rev=1540502&r1=1540501&r2=1540502&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java Sun Nov 10 18:03:41 2013
@@ -17,10 +17,10 @@
package org.apache.commons.math3.stat.regression;
import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.InsufficientDataException;
import org.apache.commons.math3.exception.MathIllegalArgumentException;
import org.apache.commons.math3.exception.NoDataException;
import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.exception.util.LocalizedFormats;
import org.apache.commons.math3.linear.NonSquareMatrixException;
import org.apache.commons.math3.linear.RealMatrix;
@@ -109,8 +109,8 @@ public abstract class AbstractMultipleLi
* @throws NullArgumentException if the data array is null
* @throws DimensionMismatchException if the length of the data array is not equal
* to <code>nobs * (nvars + 1)</code>
- * @throws NumberIsTooSmallException if <code>nobs</code> is smaller than
- * <code>nvars</code>
+ * @throws InsufficientDataException if <code>nobs</code> is less than
+ * <code>nvars + 1</code>
*/
public void newSampleData(double[] data, int nobs, int nvars) {
if (data == null) {
@@ -120,7 +120,7 @@ public abstract class AbstractMultipleLi
throw new DimensionMismatchException(data.length, nobs * (nvars + 1));
}
if (nobs <= nvars) {
- throw new NumberIsTooSmallException(nobs, nvars, false);
+ throw new InsufficientDataException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, nobs, nvars + 1);
}
double[] y = new double[nobs];
final int cols = noIntercept ? nvars: nvars + 1;
Re: Fwd: svn commit: r1540502 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
Posted by Luc Maisonobe <lu...@spaceroots.org>.
Le 11/11/2013 09:47, Thomas Neidhart a écrit :
> On 11/11/2013 01:07 AM, Phil Steitz wrote:
>> Clirr does not complain about this change, I guess because pre- and
>> post- are both unchecked, unadvertised exceptions. Before making
>> more of these changes, I want to make sure others are OK with this
>> in a dot release.
As far as I am concerned, I am OK with this.
>> Users who catch MathIllegalArgumentException will
>> not be affected by this change, but those who catch
>> NumberIsTooSmallException may break. I thought about having the new
>> exception subclass NumberIsTooSmallException, but that does not
>> really make sense to me. If others are not OK with this, I can roll
>> back this change and wait to start using the new exception in older
>> classes until 4.0.
>
> If unsure, we could make it subclass NumberIsTooSmallException for now
> and then change it to MathIllegalArgumentException in 4.0?
I'm not sure it is worth the effort, and we may well forget about it
after 3.3.
Luc
>
> Thomas
>
>> -------- Original Message --------
>> Subject: svn commit: r1540502 -
>> /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
>>
>> Date: Sun, 10 Nov 2013 18:03:41 -0000
>> From: psteitz@apache.org
>> Reply-To: dev@commons.apache.org
>> To: commits@commons.apache.org
>>
>>
>>
>> Author: psteitz
>> Date: Sun Nov 10 18:03:41 2013
>> New Revision: 1540502
>>
>> URL: http://svn.apache.org/r1540502
>> Log:
>> Changed to use InsufficientDataException when the model does not contain sufficient data for the number of regerssors; fixed error in precondition statement.
>>
>> Modified:
>> commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
>>
>> Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
>> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java?rev=1540502&r1=1540501&r2=1540502&view=diff
>> ==============================================================================
>> --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java (original)
>> +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java Sun Nov 10 18:03:41 2013
>> @@ -17,10 +17,10 @@
>> package org.apache.commons.math3.stat.regression;
>>
>> import org.apache.commons.math3.exception.DimensionMismatchException;
>> +import org.apache.commons.math3.exception.InsufficientDataException;
>> import org.apache.commons.math3.exception.MathIllegalArgumentException;
>> import org.apache.commons.math3.exception.NoDataException;
>> import org.apache.commons.math3.exception.NullArgumentException;
>> -import org.apache.commons.math3.exception.NumberIsTooSmallException;
>> import org.apache.commons.math3.exception.util.LocalizedFormats;
>> import org.apache.commons.math3.linear.NonSquareMatrixException;
>> import org.apache.commons.math3.linear.RealMatrix;
>> @@ -109,8 +109,8 @@ public abstract class AbstractMultipleLi
>> * @throws NullArgumentException if the data array is null
>> * @throws DimensionMismatchException if the length of the data array is not equal
>> * to <code>nobs * (nvars + 1)</code>
>> - * @throws NumberIsTooSmallException if <code>nobs</code> is smaller than
>> - * <code>nvars</code>
>> + * @throws InsufficientDataException if <code>nobs</code> is less than
>> + * <code>nvars + 1</code>
>> */
>> public void newSampleData(double[] data, int nobs, int nvars) {
>> if (data == null) {
>> @@ -120,7 +120,7 @@ public abstract class AbstractMultipleLi
>> throw new DimensionMismatchException(data.length, nobs * (nvars + 1));
>> }
>> if (nobs <= nvars) {
>> - throw new NumberIsTooSmallException(nobs, nvars, false);
>> + throw new InsufficientDataException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, nobs, nvars + 1);
>> }
>> double[] y = new double[nobs];
>> final int cols = noIntercept ? nvars: nvars + 1;
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: Fwd: svn commit: r1540502 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
Posted by Thomas Neidhart <th...@gmail.com>.
On 11/11/2013 01:07 AM, Phil Steitz wrote:
> Clirr does not complain about this change, I guess because pre- and
> post- are both unchecked, unadvertised exceptions. Before making
> more of these changes, I want to make sure others are OK with this
> in a dot release. Users who catch MathIllegalArgumentException will
> not be affected by this change, but those who catch
> NumberIsTooSmallException may break. I thought about having the new
> exception subclass NumberIsTooSmallException, but that does not
> really make sense to me. If others are not OK with this, I can roll
> back this change and wait to start using the new exception in older
> classes until 4.0.
If unsure, we could make it subclass NumberIsTooSmallException for now
and then change it to MathIllegalArgumentException in 4.0?
Thomas
> -------- Original Message --------
> Subject: svn commit: r1540502 -
> /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
>
> Date: Sun, 10 Nov 2013 18:03:41 -0000
> From: psteitz@apache.org
> Reply-To: dev@commons.apache.org
> To: commits@commons.apache.org
>
>
>
> Author: psteitz
> Date: Sun Nov 10 18:03:41 2013
> New Revision: 1540502
>
> URL: http://svn.apache.org/r1540502
> Log:
> Changed to use InsufficientDataException when the model does not contain sufficient data for the number of regerssors; fixed error in precondition statement.
>
> Modified:
> commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
>
> Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java?rev=1540502&r1=1540501&r2=1540502&view=diff
> ==============================================================================
> --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java (original)
> +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java Sun Nov 10 18:03:41 2013
> @@ -17,10 +17,10 @@
> package org.apache.commons.math3.stat.regression;
>
> import org.apache.commons.math3.exception.DimensionMismatchException;
> +import org.apache.commons.math3.exception.InsufficientDataException;
> import org.apache.commons.math3.exception.MathIllegalArgumentException;
> import org.apache.commons.math3.exception.NoDataException;
> import org.apache.commons.math3.exception.NullArgumentException;
> -import org.apache.commons.math3.exception.NumberIsTooSmallException;
> import org.apache.commons.math3.exception.util.LocalizedFormats;
> import org.apache.commons.math3.linear.NonSquareMatrixException;
> import org.apache.commons.math3.linear.RealMatrix;
> @@ -109,8 +109,8 @@ public abstract class AbstractMultipleLi
> * @throws NullArgumentException if the data array is null
> * @throws DimensionMismatchException if the length of the data array is not equal
> * to <code>nobs * (nvars + 1)</code>
> - * @throws NumberIsTooSmallException if <code>nobs</code> is smaller than
> - * <code>nvars</code>
> + * @throws InsufficientDataException if <code>nobs</code> is less than
> + * <code>nvars + 1</code>
> */
> public void newSampleData(double[] data, int nobs, int nvars) {
> if (data == null) {
> @@ -120,7 +120,7 @@ public abstract class AbstractMultipleLi
> throw new DimensionMismatchException(data.length, nobs * (nvars + 1));
> }
> if (nobs <= nvars) {
> - throw new NumberIsTooSmallException(nobs, nvars, false);
> + throw new InsufficientDataException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, nobs, nvars + 1);
> }
> double[] y = new double[nobs];
> final int cols = noIntercept ? nvars: nvars + 1;
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Fwd: svn commit: r1540502 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
Posted by Phil Steitz <ph...@gmail.com>.
Clirr does not complain about this change, I guess because pre- and
post- are both unchecked, unadvertised exceptions. Before making
more of these changes, I want to make sure others are OK with this
in a dot release. Users who catch MathIllegalArgumentException will
not be affected by this change, but those who catch
NumberIsTooSmallException may break. I thought about having the new
exception subclass NumberIsTooSmallException, but that does not
really make sense to me. If others are not OK with this, I can roll
back this change and wait to start using the new exception in older
classes until 4.0.
-------- Original Message --------
Subject: svn commit: r1540502 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
Date: Sun, 10 Nov 2013 18:03:41 -0000
From: psteitz@apache.org
Reply-To: dev@commons.apache.org
To: commits@commons.apache.org
Author: psteitz
Date: Sun Nov 10 18:03:41 2013
New Revision: 1540502
URL: http://svn.apache.org/r1540502
Log:
Changed to use InsufficientDataException when the model does not contain sufficient data for the number of regerssors; fixed error in precondition statement.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java?rev=1540502&r1=1540501&r2=1540502&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.java Sun Nov 10 18:03:41 2013
@@ -17,10 +17,10 @@
package org.apache.commons.math3.stat.regression;
import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.InsufficientDataException;
import org.apache.commons.math3.exception.MathIllegalArgumentException;
import org.apache.commons.math3.exception.NoDataException;
import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.exception.util.LocalizedFormats;
import org.apache.commons.math3.linear.NonSquareMatrixException;
import org.apache.commons.math3.linear.RealMatrix;
@@ -109,8 +109,8 @@ public abstract class AbstractMultipleLi
* @throws NullArgumentException if the data array is null
* @throws DimensionMismatchException if the length of the data array is not equal
* to <code>nobs * (nvars + 1)</code>
- * @throws NumberIsTooSmallException if <code>nobs</code> is smaller than
- * <code>nvars</code>
+ * @throws InsufficientDataException if <code>nobs</code> is less than
+ * <code>nvars + 1</code>
*/
public void newSampleData(double[] data, int nobs, int nvars) {
if (data == null) {
@@ -120,7 +120,7 @@ public abstract class AbstractMultipleLi
throw new DimensionMismatchException(data.length, nobs * (nvars + 1));
}
if (nobs <= nvars) {
- throw new NumberIsTooSmallException(nobs, nvars, false);
+ throw new InsufficientDataException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, nobs, nvars + 1);
}
double[] y = new double[nobs];
final int cols = noIntercept ? nvars: nvars + 1;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org