Issue Details (XML | Word | Printable)

Key: MATH-279
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Luc Maisonobe
Reporter: Michael Bjorkegren
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Math

MultipleLinearRegression - test for minimum number of samples

Created: 20/Jun/09 07:13 AM   Updated: 07/Aug/09 09:18 AM
Return to search
Component/s: None
Affects Version/s: 2.0
Fix Version/s: 2.0

Time Tracking:
Original Estimate: 0.17h
Original Estimate - 0.17h
Remaining Estimate: 0.17h
Remaining Estimate - 0.17h
Time Spent: Not Specified
Remaining Estimate - 0.17h

Resolution Date: 05/Jul/09 01:31 PM


 Description  « Hide
It's currently possible to pass in so few rows (samples) that there isn't a row for each column (predictor). Does this look like the right thing to do?
Index: AbstractMultipleLinearRegression.java
===================================================================
--- AbstractMultipleLinearRegression.java       (revision 786758)
+++ AbstractMultipleLinearRegression.java       (working copy)
@@ -91,6 +91,9 @@
                   "dimension mismatch {0} != {1}",
                   (x == null) ? 0 : x.length,
                   (y == null) ? 0 : y.length);
+        } else if (x[0].length > x.length){
+            throw MathRuntimeException.createIllegalArgumentException(
+                    "not enough data (" + x.length + " rows) for this many predictors (" + x[0].length + " predictors)");
         }
     }


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Luc Maisonobe added a comment - 05/Jul/09 01:31 PM
fixed in subversion repository as of r791244
patch was only slightly modified to avoid a NPE
thanks for the patch

Luc Maisonobe added a comment - 07/Aug/09 09:18 AM
closing resolved issue for 2.0 release