Skip to content

Reject complex calibrated association features - #5004

Merged
FlorianPfaff merged 2 commits into
mainfrom
agent/reject-complex-calibrated-features
Aug 7, 2026
Merged

Reject complex calibrated association features#5004
FlorianPfaff merged 2 commits into
mainfrom
agent/reject-complex-calibrated-features

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

CalibratedPairwiseAssociationModel validates named component planes as real numeric values, but its direct-feature predict_proba adapter used asarray(..., dtype=float64) without first checking the input dtype. Backend complex arrays can therefore lose their imaginary component during conversion and reach the classifier as different real-valued features.

For example, a feature row containing 1 + 2j can be converted to 1.0 rather than being rejected. This makes invalid association features produce plausible probabilities and costs instead of a deterministic validation error.

Fix

  • route direct predict_proba feature tensors through the existing real-numeric backend validator before flattening
  • preserve the existing float64 conversion for valid real-valued features
  • reject invalid complex features before invoking the wrapped classifier

Regression coverage

The new test supplies a backend-native complex feature tensor, verifies that ValueError is raised, and confirms that the wrapped model's predict_proba method is never called.

Validation

  • the source and regression test compile successfully in the patch workflow
  • the final branch is based on current main, zero commits behind, and changes only the association-feature implementation and one focused test
  • repository CI should provide the complete NumPy, JAX, PyTorch, lint, packaging, and documentation matrix

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 29.5s
✅ JSON prettier 7 0 0 0 1.31s
✅ JSON v8r 7 0 0 4.22s
✅ MARKDOWN markdownlint 68 0 0 0 2.0s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.86s
✅ PYTHON black 1828 64 0 0 100.68s
✅ PYTHON isort 1828 99 0 0 2.9s
✅ REPOSITORY betterleaks yes no no 2.41s
✅ REPOSITORY checkov yes no no 58.59s
✅ REPOSITORY gitleaks yes no no 17.97s
✅ REPOSITORY git_diff yes no no 0.37s
✅ REPOSITORY secretlint yes no no 92.62s
✅ REPOSITORY syft yes no no 6.51s
✅ REPOSITORY trivy-sbom yes no no 7.23s
✅ REPOSITORY trufflehog yes no no 33.3s
✅ YAML prettier 11 0 0 0 0.83s
✅ YAML v8r 11 0 0 13.48s
✅ YAML yamllint 11 0 0 0.69s

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

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.6.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

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

@FlorianPfaff
FlorianPfaff marked this pull request as ready for review August 7, 2026 18:25
@FlorianPfaff
FlorianPfaff merged commit 77754c0 into main Aug 7, 2026
26 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