# API reference Every public symbol lives in the flat `setu` namespace: import it as `from setu import NLE` regardless of which submodule defines it. The tables below group the surface by purpose for readability; each symbol is documented once, and the linked page carries the full signature, parameters, and return type. ```{eval-rst} .. currentmodule:: setu ``` ## Neural Likelihood Estimation (NLE) Learn the conditional density $p(x \mid \theta)$ with a normalizing flow. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: NLE TrainingResult create_nle fit_nle ``` ## Mixed Neural Likelihood Estimation (MixedNLE) NLE for mixed discrete + continuous data (a flow for the continuous part, a CategoricalMADE for the discrete part). ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: MixedNLE MixedNLETrainingResult create_mixed_nle fit_mixed_nle ``` ## Discrete Neural Likelihood Estimation (DiscreteNLE) NLE for pure-discrete observations: a categorical head for bounded counts, or a CountMADE (ZINB / NegBinom / Poisson) for count data. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: DiscreteNLE DiscreteNLETrainingResult create_discrete_nle fit_discrete_nle ``` ## Neural Ratio Estimation (NRE) Learn a likelihood-to-evidence ratio with a classifier instead of a normalized density. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: NRE NRETrainingResult create_nre fit_nre ``` ## Data Simulation datasets and shape helpers. See {doc}`shapes` for the `(G, S, T, *E)` conventions these follow. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: SimulationDataset ValidationDataset simulate_dataset one_hot broadcast_conditions ``` ## Serialization Save and load trained estimators (Equinox leaves plus a JSON metadata sidecar). ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: save_estimator load_estimator ``` ## Transforms Z-scoring transforms applied to parameters and observations. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: Standardizer ``` ## Metrics Sample-based distances for comparing estimator draws against ground truth. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: c2st mmd sliced_wasserstein total_variation ``` ## Simulators Reference simulators and their analytical likelihoods, used in tests and tutorials. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: linear_gaussian sample_prior analytical_log_likelihood analytical_log_ratio analytical_marginal_log_prob ``` ## PyMC integration Export a trained estimator as a PyMC likelihood term. See {doc}`shapes` for the `(theta, x_observed)` argument order. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: to_pymc to_pymc_hierarchical mixed_nle_to_pymc discrete_nle_to_pymc nre_to_pymc nre_to_pymc_hierarchical ``` ## NumPyro integration Export a trained estimator as a NumPyro factor. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: to_numpyro to_numpyro_hierarchical discrete_nle_to_numpyro nre_to_numpyro nre_to_numpyro_hierarchical ``` ## Leave-one-out cross-validation ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: compute_log_likelihood ``` ## Tuning Optuna-based hyperparameter search. Requires the `tuning` extra (`pip install setu-sbi[tuning]`). ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: tune_nle tune_nre tune_mixed_nle TuningResult NLESearchSpace NRESearchSpace MixedNLESearchSpace ``` ## Predictive checks Prior and posterior predictive sampling. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: prior_predictive posterior_predictive PriorPredictiveResult ``` ## Validation Diagnostics that confirm a learned likelihood is trustworthy before export. ```{eval-rst} .. autosummary:: :toctree: _autosummary :nosignatures: validate_nle validate_estimator ValidationConfig ValidationResult ValidationError ```