Skip to content

Fix symmetric vMF mixture handling on the hyperhemisphere - #5396

Merged
FlorianPfaff merged 5 commits into
mainfrom
fix-hyperhemispherical-mixture-update
Aug 23, 2026
Merged

Fix symmetric vMF mixture handling on the hyperhemisphere#5396
FlorianPfaff merged 5 commits into
mainfrom
fix-hyperhemispherical-mixture-update

Conversation

@FlorianPfaff

@FlorianPfaff FlorianPfaff commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • require two-component hyperspherical mixtures to actually satisfy the documented symmetric-vMF contract
  • reject unequal vMF concentrations and non-antipodal component modes in identity measurement updates
  • reject non-vMF mixtures in the prediction helper instead of silently evaluating them with a vMF transition formula
  • recenter valid measurement mixtures with set_mode(...) rather than mutating caller-owned component means
  • add focused regressions for symmetry, ownership, type safety, and unit-measurement validation

Bugs

1. Asymmetric mixtures accepted by update_identity

HyperhemisphericalGridFilter.update_identity(...) documents support for a symmetric two-component HypersphericalMixture, but main only checks that the mixture has two 0.5-weight components and then overwrites their means with z and -z.

For two vMF components, equal weights are not sufficient for antipodal symmetry: their mean directions must be antipodal and their concentrations must match. With unequal kappa, p(x) != p(-x), yet the hyperhemisphere update evaluates 2 * meas_noise.pdf(...). That makes the likelihood depend on which antipodal representative is used.

The upstream libDirectional update path also omits the equal-concentration check, while its transition-density path correctly requires equal concentrations.

Direct .mu assignment additionally mutates the caller-provided noise model and bypasses vMF unit-direction validation.

2. Non-vMF mixtures interpreted as vMF system noise

sys_noise_to_transition_density(...) checks mixture weights, means, and kappa, but not the component type. A symmetric 50/50 mixture of two Watson distributions therefore passes the condition and is then evaluated using the vMF transition formula. This silently changes the model rather than rejecting an unsupported noise family.

Fix

Mixture-based update/prediction paths now require:

  • exactly two components
  • 50/50 weights
  • vMF components
  • antipodal component mean directions
  • equal concentrations

Valid measurement components are recentered via their non-mutating set_mode(...) API, which also validates that z is a unit direction.

Validation

Focused regressions cover:

  • measurement-noise object is unchanged after a valid update
  • unequal concentrations are rejected
  • non-antipodal vMF components are rejected
  • non-unit measurements are rejected rather than being written into a vMF object
  • symmetric non-vMF mixtures are rejected by the prediction helper instead of being reinterpreted as vMF

GitHub Actions is the authoritative full backend/lint/integration validation.

@FlorianPfaff FlorianPfaff changed the title Fix asymmetric mixture updates on the hyperhemisphere Fix symmetric vMF mixture handling on the hyperhemisphere Aug 22, 2026
@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) August 22, 2026 20:34
@github-actions

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 6.85s
✅ JSON prettier 7 0 0 0 0.68s
✅ JSON v8r 7 0 0 5.07s
✅ MARKDOWN markdownlint 68 0 0 0 2.5s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.59s
✅ PYTHON black 2010 24 0 0 69.24s
✅ PYTHON isort 2010 40 0 0 3.06s
✅ REPOSITORY betterleaks yes no no 1.54s
✅ REPOSITORY checkov yes no no 36.14s
✅ REPOSITORY git_diff yes no no 0.13s
✅ REPOSITORY secretlint yes no no 108.45s
✅ REPOSITORY syft yes no no 2.64s
✅ REPOSITORY trivy-sbom yes no no 2.81s
✅ YAML prettier 11 0 0 0 0.68s
✅ YAML v8r 11 0 0 14.63s
✅ YAML yamllint 11 0 0 1.11s

Notices

⚠️ Your configuration references items that have been removed from MegaLinter and are ignored: MAKEFILE_CHECKMAKE. See Removed linters to find their replacements.

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@10.0.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_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

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

@FlorianPfaff
FlorianPfaff merged commit 891d924 into main Aug 23, 2026
15 of 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