setu.mixed_nle_to_pymc#
- setu.mixed_nle_to_pymc(mixed_nle, theta, x_observed, *, conditions=None, chunk_size=None, name='mixed_nle_likelihood', dims=None)[source]#
Convert trained MixedNLE to PyMC likelihood.
Validates that discrete columns contain integer values, then delegates to to_pymc (which accepts any likelihood estimator).
- Parameters:
mixed_nle (
MixedNLE) – Trained MixedNLE instancetheta (
TensorVariable) – PyMC parameter variablex_observed (
Array) – Observed data (n_obs, x_dim) or (x_dim,) with continuous variables in first columns, discrete in lastconditions (
Array|None) – Optional experimental conditions (n_obs, condition_dim)chunk_size (
int|None) – If provided, process observations in chunks of this size to reduce peak memory usage.name (
str) – Name for the PyMC potentialdims (
tuple[str,...] |None) – PyMC dimension names (for coords)
- Return type:
Potential- Returns:
PyMC Potential adding log p(x_observed | theta, conditions) to model
Example
- with pm.Model():
theta = pm.Normal(“theta”, 0, 1, shape=2) likelihood = mixed_nle.to_pymc(theta, x_observed) trace = pm.sample(nuts_sampler=”blackjax”)