commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r791244 - in /commons/proper/math/trunk: ./ src/java/org/apache/commons/math/ src/java/org/apache/commons/math/stat/regression/ src/site/xdoc/ src/test/org/apache/commons/math/stat/regression/
Date Sun, 05 Jul 2009 13:29:38 GMT
Author: luc
Date: Sun Jul  5 13:29:37 2009
New Revision: 791244

URL: http://svn.apache.org/viewvc?rev=791244&view=rev
Log:
Added a check for too few data in linear regression
JIRA: MATH-279

Modified:
    commons/proper/math/trunk/pom.xml
    commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/AbstractMultipleLinearRegression.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/GLSMultipleLinearRegressionTest.java

Modified: commons/proper/math/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/pom.xml?rev=791244&r1=791243&r2=791244&view=diff
==============================================================================
--- commons/proper/math/trunk/pom.xml (original)
+++ commons/proper/math/trunk/pom.xml Sun Jul  5 13:29:37 2009
@@ -109,6 +109,9 @@
       <name>R&#233;mi Arntzen</name>
     </contributor>
     <contributor>
+      <name>Michael Bjorkegren</name>
+    </contributor>
+    <contributor>
       <name>John Bollinger</name>
     </contributor>
     <contributor>

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java?rev=791244&r1=791243&r2=791244&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java Sun
Jul  5 13:29:37 2009
@@ -311,12 +311,6 @@
     { "{0} method needs at least one previous point",
       "la m\u00e9thode {0} n\u00e9cessite au moins un point pr\u00e9c\u00e9dent" },
 
-    // org.apache.commons.math.ode.stiff.BDFIntegrator
-    { "unsupported order {0} for BDF methods, must be between {1} and {2}",
-      "ordre {0} non support\u00e9 pour les m\u00e9thodes BDF, doit \u00eatre entre {1} et
{2}" },
-    { "corrector failed to converge after {0} iterations at t = {1}",
-      "\u00e9chec de convergence du correcteur apr\u00e8s {0} it\u00e9rations \u00e0 t =
{1}" },
-
     // org.apache.commons.math.ode.ContinuousOutputModel
     // org.apache.commons.math.optimization.direct.DirectSearchOptimizer
     { "unexpected exception caught",
@@ -729,6 +723,10 @@
    { "matrix is not upper-triangular, entry ({0}, {1}) = {2} is too large",
      "matrice non triangulaire sup\u00e9rieure, l''\u00e9l\u00e9ment ({0}, {1}) = {2} est
trop grand" },
 
+   // org.apache.commons.math.stat.regression.AbstractMultipleLinearRegression
+   { "not enough data ({0} rows) for this many predictors ({1} predictors)",
+     "pas assez de donn\u00e9es ({0} lignes) pour {1} pr\u00e9dicteurs" },
+
    // org.apache.commons.math.distribution.AbstractContinuousDistribution
    // org.apache.commons.math.distribution.AbstractIntegerDistribution
    // org.apache.commons.math.distribution.ExponentialDistributionImpl

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/AbstractMultipleLinearRegression.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/AbstractMultipleLinearRegression.java?rev=791244&r1=791243&r2=791244&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/AbstractMultipleLinearRegression.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/AbstractMultipleLinearRegression.java
Sun Jul  5 13:29:37 2009
@@ -91,6 +91,10 @@
                   "dimension mismatch {0} != {1}",
                   (x == null) ? 0 : x.length,
                   (y == null) ? 0 : y.length);
+        } else if ((x.length > 0) && (x[0].length > x.length)) {
+            throw MathRuntimeException.createIllegalArgumentException(
+                  "not enough data ({0} rows) for this many predictors ({1} predictors)",
+                  x.length, x[0].length);
         }
     }
 

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=791244&r1=791243&r2=791244&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sun Jul  5 13:29:37 2009
@@ -39,6 +39,9 @@
   </properties>
   <body>
     <release version="2.0" date="TBD" description="TBD">
+      <action dev="luc" type="add" issue="MATH-279" due-to="Michael Bjorkegren">
+        Added a check for too few rows with respect to the number of predictors in linear
regression
+      </action>
       <action dev="luc" type="add" due-to="Dimitri Pourbaix">
         Added a getCovariance method to singular value decomposition
       </action>

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/GLSMultipleLinearRegressionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/GLSMultipleLinearRegressionTest.java?rev=791244&r1=791243&r2=791244&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/GLSMultipleLinearRegressionTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/GLSMultipleLinearRegressionTest.java
Sun Jul  5 13:29:37 2009
@@ -70,6 +70,17 @@
     }
     
     @Test(expected=IllegalArgumentException.class)
+    public void notEnoughData() {
+        double[]   reducedY = new double[y.length - 1];
+        double[][] reducedX = new double[x.length - 1][];
+        double[][] reducedO = new double[omega.length - 1][];
+        System.arraycopy(y,     0, reducedY, 0, reducedY.length);
+        System.arraycopy(x,     0, reducedX, 0, reducedX.length);
+        System.arraycopy(omega, 0, reducedO, 0, reducedO.length);
+        createRegression().newSampleData(reducedY, reducedX, reducedO);
+    }
+    
+    @Test(expected=IllegalArgumentException.class)
     public void cannotAddCovarianceDataWithSampleSizeMismatch() {
         double[] y = new double[]{1.0, 2.0};
         double[][] x = new double[2][];



Mime
View raw message