Product Prior¶
Product of independent marginal distributions with latent space transformations.
Overview¶
Product defines a prior as a product of independent 1D marginals, each with a
bijective map to a chosen latent space. It extends the abstract base class
TransformedPrior, which defines the forward/inverse interface.
Product supports two latent-space modes:
"hypercube": Maps to/from a bounded hypercube (used with Flow)"standard_normal": Maps to/from standard normal space (used with Gaussian)
Supported Distributions¶
| Type | Parameters | Description |
|---|---|---|
uniform |
low, high |
Uniform distribution |
normal |
mean, std |
Gaussian distribution |
cosine |
low, high |
Cosine-weighted distribution |
sine |
low, high |
Sine-weighted distribution |
uvol |
low, high |
Uniform-in-volume |
triangular |
a, c, b |
Triangular distribution (min, mode, max) |
lognormal |
mean, std |
Log-normal distribution |
fixed |
value |
Fixed (non-inferred) parameter |
Fixed Parameters¶
Use the fixed distribution type to hold a parameter constant. Fixed parameters
are excluded from the inferred parameter space but still appear in the full
parameter vector passed to the simulator:
simulator:
_target_: falcon.priors.Product
priors:
- ['normal', 0.0, 1.0] # Inferred
- ['fixed', 3.14] # Held constant
- ['uniform', -1.0, 1.0] # Inferred
Usage¶
from falcon.priors import Product
prior = Product(
priors=[
('normal', 0.0, 1.0),
('uniform', -10.0, 10.0),
]
)
# Sample from prior
samples = prior.simulate_batch(1000)
# Transform to/from latent space
z = prior.inverse(samples, mode="standard_normal")
x = prior.forward(z, mode="standard_normal")
YAML Configuration¶
With Flow estimator¶
simulator:
_target_: falcon.priors.Product
priors:
- ['uniform', -100.0, 100.0]
- ['uniform', -100.0, 100.0]
With Gaussian estimator¶
Class Reference¶
TransformedPrior
¶
Bases: ABC
Base class for priors that support latent space transformations.
Subclasses must implement forward() and inverse() with a mode parameter: - forward(z, mode): latent space -> parameter space - inverse(x, mode): parameter space -> latent space
Modes
- "hypercube": Maps to/from bounded hypercube. Use with Flow estimator.
- "standard_normal": Maps to/from N(0, I). Use with Gaussian estimator.
This base class is used for type checking in estimators like Gaussian that require the transformation interface.
Product
¶
Bases: TransformedPrior
Maps between target distributions and a latent space (hypercube or standard normal).
Supports bi-directional transformation with mode selection at call time
- forward(z, mode): latent space -> target distribution
- inverse(x, mode): target distribution -> latent space
Modes
- "hypercube": Maps to/from hypercube domain (default [-2, 2]). Use with Flow estimator.
- "standard_normal": Maps to/from N(0, I). Use with Gaussian estimator.
Supported distribution types and their required parameters
- "uniform": Linear mapping. Parameters: low, high.
- "cosine": Uses acos transform for pdf ∝ sin(angle). Parameters: low, high.
- "sine": Uses asin transform. Parameters: low, high.
- "uvol": Uniform-in-volume. Parameters: low, high.
- "normal": Normal distribution. Parameters: mean, std.
- "triangular": Triangular distribution. Parameters: a (min), c (mode), b (max).
- "fixed": Fixed value (excluded from latent space). Parameters: value.
Example
prior = Product([ ("uniform", -100.0, 100.0), ("fixed", 5.0), # Fixed parameter, not in latent space ("normal", 0.0, 1.0), ])
Latent space has dim=2 (only free params)¶
Output space has dim=3 (includes fixed params)¶
For Gaussian estimator (standard normal latent space)¶
z = prior.inverse(theta, mode="standard_normal") # theta: (..., 3) -> z: (..., 2) theta = prior.forward(z, mode="standard_normal") # z: (..., 2) -> theta: (..., 3)
For Flow estimator (hypercube latent space)¶
u = prior.inverse(theta, mode="hypercube") theta = prior.forward(u, mode="hypercube")
Initialize Product.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
priors
|
List of tuples (dist_type, param1, param2, ...). |
[]
|
|
hypercube_range
|
Range for hypercube mode (default: [-2, 2]). |
[-2, 2]
|
Source code in falcon/priors/product.py
forward
¶
Map from latent space to target distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
Tensor of shape (..., param_dim) in latent space (free params only). |
required | |
mode
|
"hypercube" or "standard_normal". |
'hypercube'
|
Returns:
| Type | Description |
|---|---|
|
Tensor of shape (..., full_param_dim) in target distribution space. |
Source code in falcon/priors/product.py
inverse
¶
Map from target distribution to latent space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor of shape (..., full_param_dim) in target distribution space. |
required | |
mode
|
"hypercube" or "standard_normal". |
'hypercube'
|
Returns:
| Type | Description |
|---|---|
|
Tensor of shape (..., param_dim) in latent space (free params only). |
Source code in falcon/priors/product.py
simulate_batch
¶
Generate samples from the target distributions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_size
|
Number of samples. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy array of shape (batch_size, full_param_dim) in target distribution space. |