Skip to content

Add mixed distribution support to TrueMeasure - #615

Open
Laasya-73 wants to merge 1 commit into
developfrom
feature/mixed-distribution
Open

Add mixed distribution support to TrueMeasure#615
Laasya-73 wants to merge 1 commit into
developfrom
feature/mixed-distribution

Conversation

@Laasya-73

Copy link
Copy Markdown
Collaborator

Summary

This PR adds support for finite mixed distributions through a new Mixture TrueMeasure.

Given component distributions with densities

$$\rho_0(x), \rho_1(x), \ldots, \rho_{s-1}(x)$$

and probabilities

$$p_0, p_1, \ldots, p_{s-1}, \qquad p_j > 0, \qquad \sum_{j=0}^{s-1} p_j = 1,$$

the resulting mixed distribution has density

$$\rho(x) = \sum_{j=0}^{s-1} p_j \rho_j(x).$$

To sample from the mixture, Mixture uses one additional uniform coordinate. For a component dimension d, the outer sampler therefore has dimension d + 1.

For

$$u = (u_0, u_1, \ldots, u_d) \in [0,1]^{d+1},$$

the first coordinate $u_0$ selects a component according to the cumulative probabilities, and the remaining coordinates $(u_1, \ldots, u_d)$ are passed through the selected component's existing TrueMeasure transform. The resulting sample is in dimension d.

Implementation

  • Adds a general Mixture TrueMeasure that can combine different compatible TrueMeasure components.
  • Requires all components to have the same output dimension.
  • Validates component types, probabilities, and the required d + 1 sampler dimension.
  • Uses each selected component's recursive transform, so composed TrueMeasures are preserved.
  • Computes mixture weights as the probability-weighted sum of the component weights.
  • Supports replicated samples and same-dimension spawning.
  • Exposes Mixture through the public qmcpy API.

A new demo notebook shows the selection mechanism as well as mixtures involving different component types, including Gaussian, zero-inflated, bounded, heavy-tailed, composed, and multidimensional examples.

Tests

Added focused tests for component selection, cumulative-probability boundaries, validation, mixture weights, composed transforms, spawning, and replicated samples.

@Laasya-73 Laasya-73 self-assigned this Sep 1, 2026
@Laasya-73 Laasya-73 added the enhancement New feature or request label Sep 1, 2026

@fjhickernell fjhickernell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this Laasya.

We talked and I requested an example showing the advantage of mixture sampling over non-mixture sampling. Let me know when you have added that.

@Laasya-73

Copy link
Copy Markdown
Collaborator Author

Thanks for doing this Laasya.

We talked and I requested an example showing the advantage of mixture sampling over non-mixture sampling. Let me know when you have added that.

Sure!!

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants