Skip to content

Validate Gaussian mixture parameter shapes - #5065

Closed
FlorianPfaff wants to merge 2 commits into
mainfrom
agent/validate-gaussian-mixture-parameter-shapes
Closed

Validate Gaussian mixture parameter shapes#5065
FlorianPfaff wants to merge 2 commits into
mainfrom
agent/validate-gaussian-mixture-parameter-shapes

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

GaussianMixture.mixture_parameters_to_gaussian_parameters() accepted means and covariance tensors without verifying that both described the same component set.

For example, two scalar component means and two weights could be combined with only one covariance matrix. NumPy-style broadcasting duplicated that single covariance across the component axis and returned a plausible Gaussian instead of reporting incomplete mixture data. A covariance matrix with no component axis could be broadcast similarly.

Fix

  • normalize the public means and covariance inputs to backend arrays before structural validation;
  • accept scalar-component means shaped (n_components,) and vector-component means shaped (n_components, state_dim);
  • require at least one nonempty component mean;
  • require covariance tensors to have the exact shape (state_dim, state_dim, n_components) before weighting;
  • preserve the existing weight normalization and moment-matching calculation for valid inputs.

Regression coverage

  • reject two means supplied with only one scalar covariance;
  • reject a multidimensional covariance matrix that omits the component axis;
  • verify matching scalar-component inputs still produce mean 1.5 and covariance 3.25.

Validation

  • branch is 2 commits ahead and 0 behind current main;
  • final diff is limited to the Gaussian-mixture implementation and one focused regression module;
  • full backend, test, lint, documentation, packaging, and security validation is delegated to GitHub Actions.

@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 24.51s
✅ JSON prettier 7 0 0 0 1.01s
✅ JSON v8r 7 0 0 4.49s
✅ MARKDOWN markdownlint 68 0 0 0 2.23s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.88s
✅ PYTHON black 1833 72 0 0 88.29s
✅ PYTHON isort 1833 109 0 0 2.68s
✅ REPOSITORY betterleaks yes no no 2.54s
✅ REPOSITORY checkov yes no no 51.26s
✅ REPOSITORY gitleaks yes no no 17.78s
✅ REPOSITORY git_diff yes no no 0.29s
✅ REPOSITORY secretlint yes no no 79.68s
✅ REPOSITORY syft yes no no 6.46s
✅ REPOSITORY trivy-sbom yes no no 4.97s
✅ REPOSITORY trufflehog yes no no 31.08s
✅ YAML prettier 11 0 0 0 0.7s
✅ YAML v8r 11 0 0 11.19s
✅ YAML yamllint 11 0 0 0.66s

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

Copy link
Copy Markdown
Owner Author

Closing as superseded by #5238. Both change GaussianMixture.mixture_parameters_to_gaussian_parameters, but #5238 fixes the same component/covariance shape bug while preserving valid scalar, 1-D, and single-component (dim, dim) covariance shorthands. Keeping both would create overlapping, incompatible implementations and duplicate regression coverage.

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