Skip to content

Preserve Gaussian subclasses during marginalization - #5387

Open
FlorianPfaff wants to merge 2 commits into
mainfrom
chatgpt/fix-gaussian-subclass-marginalization
Open

Preserve Gaussian subclasses during marginalization#5387
FlorianPfaff wants to merge 2 commits into
mainfrom
chatgpt/fix-gaussian-subclass-marginalization

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Summary

  • preserve the runtime Gaussian subclass in GaussianDistribution.marginalize_out()
  • add focused regression coverage for a 2-D derived Gaussian marginalized to 1-D

Bug

marginalize_out() constructed its result with GaussianDistribution(...) directly. A custom subclass therefore silently became the base class after marginalization, even though the adjacent multiply() and convolve() operations now preserve the left-hand subclass after #5385.

Fix

Construct the marginal with type(self)(...), matching the subclass-preserving behavior of the other Gaussian-returning operations.

Regression coverage

The new test constructs a derived 2-D Gaussian, marginalizes one dimension, and verifies that the result remains an instance of the derived class with the expected dimension.

The branch is based on current main after #5385 and changes only the one constructor call plus the focused regression test.

@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 8.32s
✅ JSON prettier 7 0 0 0 0.66s
✅ JSON v8r 7 0 0 4.59s
✅ MARKDOWN markdownlint 68 0 0 0 2.12s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.41s
✅ PYTHON black 2007 22 0 0 66.33s
✅ PYTHON isort 2007 38 0 0 2.94s
✅ REPOSITORY betterleaks yes no no 1.32s
✅ REPOSITORY checkov yes no no 34.71s
✅ REPOSITORY git_diff yes no no 0.15s
✅ REPOSITORY secretlint yes no no 104.88s
✅ REPOSITORY syft yes no no 3.51s
✅ REPOSITORY trivy-sbom yes no no 2.84s
✅ YAML prettier 11 0 0 0 0.65s
✅ YAML v8r 11 0 0 15.89s
✅ YAML yamllint 11 0 0 0.87s

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

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