Skip to content

Add a common MDN network interface (consistent with new DensityEstimators) #989

Closed

Description

@manuelgloeckler

Description

The MDN (Mixture Density Network) — a Gaussian Mixture Density network — currently receives several "special" treatments in the codebase:

  • SNPE_A relies on it and implements a custom SNPE_A_MDN wrapper with specific corrections.
  • SNPE_C uses a specialized loss function for MDN.
  • conditional_density.py defines a custom ConditionedMDN to handle "marginalization" properties.

Given these various custom implementations, it would be beneficial to consolidate all MDN-related wrappers and functionalities into a single class: MDNDensityEstimator. This new class will adhere to the existing DensityEstimator structure, providing a more unified and streamlined approach.

Advantages:

  • Reduced Code Duplication: By consolidating the MDN-related code, we eliminate repetitive implementations and centralize the logic.
  • Improved Typing: A unified class will provide more consistent and clear typing across the library.
  • Simplified Maintenance: Consolidating MDN functionality into one place will make future updates, bug fixes, and enhancements easier to manage.

This refactor will improve the readability, maintainability, and scalability of the codebase.

For a first approach see #1042 .

Activity

  1. added
    enhancement
    hackathon
    on Mar 13, 2024
  2. self-assigned this
    on Mar 18, 2024
  3. bkmi commented on Mar 19, 2024

    @bkmi
    Contributor

    I find the SNPE_A_MDN class quite confusing. Is there a loss implemented for it yet? Why does it only inherit from DensityEstimator but not implement all methods?

  4. linked a pull request that will close this issueAdd MDNDensityEstimator #1042on Mar 19, 2024
  5. removed
    hackathon
    on Jul 22, 2024
  6. janfb commented on Jul 22, 2024

    @janfb
    Contributor

    This is being worked on in #1042 but it will not make it into the release in August.

  7. removed this from the Hackathon 2024 milestone on Jul 22, 2024
  8. added
    hackathon
    on Feb 24, 2025
  9. janfb commented on Jan 20, 2026

    @janfb
    Contributor

    Needs review in #1724

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementhackathon

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions