Repository navigation
Conversation
removeData divides by n - 1, so removing the last observation set sumXX, sumYY and sumXY to NaN when the model has an intercept. addData only resets xbar and ybar at n == 0, so every later fit on the instance returned NaN until clear(). Removing the last observation now clears the model. Move the line-number pin of the existing UnnecessaryParentheses suppression for regress() from 823 to 827.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #360 +/- ##
============================================
+ Coverage 86.54% 87.24% +0.70%
+ Complexity 9787 91 -9696
============================================
Files 532 499 -33
Lines 35516 33544 -1972
Branches 6194 5857 -337
============================================
- Hits 30738 29267 -1471
+ Misses 3518 3160 -358
+ Partials 1260 1117 -143 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reproduced on master, JDK 21:
removeDatadivides byn - 1, so removing the last observation setssumXX,sumYYandsumXYto NaN (0 * Infinity) when the model has an intercept, which is the default.addDataonly resetsxbarandybaratn == 0, so the NaN sums survive and every later fit on the instance is NaN untilclear(). The documented sliding-window use hits this whenever the window drains,removeData(double[][])included, andappendof an emptied instance turns a healthy fit's slope into NaN too.Removing the last observation now clears the model, which is the state an empty model is in anyway. Removals that leave at least one observation are unchanged. The UnnecessaryParentheses suppression for
regress()incheckstyle-suppressions-legacy.xmlis pinned by line number, so it moves from 823 to 827.testRemoveToEmptyThenReuseinSimpleRegressionTestfails on master (expected:<0.0> but was:<NaN>) and passes with the fix.mvn clean verify javadoc:javadoc -pl commons-math-legacyis green on JDK 21 (3266 tests, 0 Checkstyle violations; the only reruns are the randomised optimizer tests).