Skip to content

Fix empty array edge cases in stepwisefit - #484

Merged
pr0m1th3as merged 4 commits into
gnu-octave:mainfrom
Sonu0305:fix-stepwisefit-empty
Sep 15, 2026
Merged

pr0m1th3as merged 4 commits into
gnu-octave:mainfrom
Sonu0305:fix-stepwisefit-empty

Conversation

@Sonu0305

Copy link
Copy Markdown
Contributor

No description provided.

@pr0m1th3as

Copy link
Copy Markdown
Member

Please, add the error message in the first BIST as well.

@pr0m1th3as

Copy link
Copy Markdown
Member

Measured on MATLAB R2024a, the empty result differs: stats.dfe is 0 and stats.df0 is -1 (swapped here), stats.intercept is 0, stats.covb is 3x3, and history is empty (B 3x0, rmse [], df0 [], in 0x3). The Keep test still checks nothing: the %!error line is its own block where X and y are undefined, so it passes on any error. Make it one %!error with the full message and the data inline. Add the period to "X and Y must have the same number of rows", and pass 'Display', 'off' in the tests.

@Sonu0305
Sonu0305 force-pushed the fix-stepwisefit-empty branch from bdae0bf to 8e0f953 Compare September 14, 2026 15:46
@Sonu0305

Copy link
Copy Markdown
Contributor Author

updated @pr0m1th3as
can you review again?
thank you

@pr0m1th3as
pr0m1th3as merged commit 8e72da2 into gnu-octave:main Sep 15, 2026
pr0m1th3as added a commit that referenced this pull request Sep 15, 2026
  A wrong 'Keep' or 'InModel' on data with no complete observation now
  raises its error instead of returning the empty result, and the empty
  result lists its fields in the same order as a fitted one.

  * stepwisefit.m: check options before returning the empty result; order
  its stats and history fields as a fit does; drop a repeated check on Y;
  test every empty output and the 'Keep' error on empty data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants