Skip to content

Stabilize MEM-RBPF particle log likelihoods#4549

Merged
FlorianPfaff merged 5 commits into
mainfrom
agent/stabilize-mem-rbpf-particle-logdet-20260721
Jul 21, 2026
Merged

Stabilize MEM-RBPF particle log likelihoods#4549
FlorianPfaff merged 5 commits into
mainfrom
agent/stabilize-mem-rbpf-particle-logdet-20260721

Conversation

@FlorianPfaff

@FlorianPfaff FlorianPfaff commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Bug

MEMRBPFTracker._update_particle_weights() formed det(marginal_cov) before taking its logarithm. For valid positive-definite but very small covariance matrices, the determinant can underflow to zero in float64.

When that happened, the affected particle likelihoods were replaced with -inf. If every particle covariance underflowed, log-weight normalization fell back to uniform weights and discarded otherwise valid measurement information.

Fix

  • compute the covariance log-determinant from its symmetric eigenvalues without forming the determinant;
  • reject non-finite or non-positive eigenvalues before evaluating the likelihood;
  • use only linear-algebra operations already exported by the NumPy and PyTorch backend facade;
  • add a regression with two valid covariance scales whose ordinary determinants both underflow.

Impact

MEM-RBPF particle updates now preserve relative likelihood information for extremely concentrated valid covariances instead of silently resetting the particle weights to uniform.

Validation

  • branch is 3 commits ahead of main and 0 behind;
  • final diff is limited to 6 source additions/3 deletions and one 38-line regression test;
  • analytical reproduction: the old determinant path yields [-inf, -inf], while the stable path produces normalized weights [2/3, 1/3];
  • the implementation uses eigvalsh, isfinite, log, and reductions already supported by the MEM-RBPF backends;
  • repository GitHub Actions exercise the focused NumPy regression and the broader test suite.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 23.53s
✅ JSON prettier 7 0 0 0 1.14s
✅ JSON v8r 7 0 0 4.91s
✅ MARKDOWN markdownlint 68 0 0 0 1.81s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.89s
✅ PYTHON black 1585 221 0 0 92.27s
✅ PYTHON isort 1585 401 0 0 2.67s
✅ REPOSITORY betterleaks yes no no 2.73s
✅ REPOSITORY checkov yes no no 52.56s
✅ REPOSITORY gitleaks yes no no 15.46s
✅ REPOSITORY git_diff yes no no 0.69s
✅ REPOSITORY secretlint yes no no 63.09s
✅ REPOSITORY syft yes no no 5.65s
✅ REPOSITORY trivy-sbom yes no no 5.39s
✅ REPOSITORY trufflehog yes no no 31.77s
✅ YAML prettier 11 0 0 0 0.75s
✅ YAML v8r 11 0 0 12.63s
✅ YAML yamllint 11 0 0 0.52s

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 July 21, 2026 20:09
@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) July 21, 2026 20:09
@FlorianPfaff
FlorianPfaff merged commit e9ae293 into main Jul 21, 2026
25 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