Skip to content

BUG: Reject infeasible max_elt in corr_thresholded - #11302

Open
xihaian251 wants to merge 1 commit into
statsmodels:mainfrom
xihaian251:sprint3-final/F
Open

xihaian251 wants to merge 1 commit into
statsmodels:mainfrom
xihaian251:sprint3-final/F

Conversation

@xihaian251

Copy link
Copy Markdown
Contributor

Problem

  • When max_elt is smaller than the number of rows, the calculated block size is zero.
  • The processing loop consequently fails to advance.

Changes

  • Raise a clear ValueError when the calculated block size is smaller than one.
  • Preserve the documented memory constraint.
  • Leave the existing computation unchanged for feasible block sizes.

Validation

  • Timeout-protected regression test for the original infinite loop.
  • Boundary tests at and above the minimum feasible max_elt.
  • Independent Pearson correlation reference calculation.
  • test_corrpsd.py: 28 passed.

AI Disclosure

Contributions must comply with the statsmodels AI Policy.
Tick exactly one of the following. If AI tools were used, replace the <...> placeholders in the second option with the tool name(s) and how the tool's output was used.

  • No AI tools were used to develop this pull request.
  • AI tools were used. Tool(s): WorkBuddy, Wolfram. Used for: implementation, regression testing, debugging and independent validation (WorkBuddy); independent mathematical and numerical cross-checks (Wolfram). I have personally read, understood, and can explain every line of this diff, and have verified the statistical/numerical correctness of the change.

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.

1 participant