Skip to content

Fix association model solve fallback#2205

Merged
FlorianPfaff merged 3 commits into
mainfrom
fix-association-singular-solve-fallback
May 23, 2026
Merged

Fix association model solve fallback#2205
FlorianPfaff merged 3 commits into
mainfrom
fix-association-singular-solve-fallback

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Owner

Summary

  • make LogisticPairwiseAssociationModel's Newton solve fallback backend-neutral by retrying with pinv for backend runtime/value errors as well as NumPy LinAlgError
  • retry with pinv when a backend solve returns non-finite steps, and fail explicitly if the fallback is also non-finite
  • add focused regressions for raised backend solve errors and non-finite solve results

Rationale

The association model fit loop uses the active backend's linalg.solve, but previously only caught numpy.linalg.LinAlgError. Non-NumPy backends may signal singular or unsupported linear solves with different exception types, and some backend solve implementations can return non-finite values instead of raising. In both cases, the existing pseudoinverse fallback was bypassed and bad Newton steps could propagate into fitted parameters.

Validation

  • Syntax-compiled the modified source and test file in the sandbox.
  • Reviewed the branch diff through the GitHub connector: 2 files changed (src/pyrecest/utils/association_models.py, tests/test_association_models.py).
  • Direct repository checkout and pytest execution were not possible here because the sandbox could not resolve github.com; PR CI should run the focused and full test matrix.

@github-actions
Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 37.34s
✅ PYTHON black 2 2 0 0 2.68s
✅ PYTHON isort 2 2 0 0 0.44s
✅ REPOSITORY checkov yes no no 32.09s
✅ REPOSITORY gitleaks yes no no 17.57s
✅ REPOSITORY git_diff yes no no 0.06s
✅ REPOSITORY secretlint yes no no 13.94s
✅ REPOSITORY syft yes no no 2.33s
✅ REPOSITORY trivy-sbom yes no no 3.84s
✅ REPOSITORY trufflehog yes no no 23.99s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@FlorianPfaff FlorianPfaff enabled auto-merge (squash) May 23, 2026 16:03
@FlorianPfaff FlorianPfaff merged commit dac66b4 into main May 23, 2026
41 of 42 checks passed
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