Skip to content

Getting rid of posterior_nn, likelihood_nn,... #1659

@michaeldeistler

Description

@michaeldeistler

Currently, our networks are built like this:

density_estimator_builder = posterior_nn("maf")
inference = NPE(density_estimator=density_estimator_builder)

I think this is very suboptimal, because posterior_nn has very little flexibility. For example, it is unclear to me how one would use it to modify the neural networks used by MNPE (see here).

How to fix this? We actually do have another level of entry which is much more flexible:

density_estimator = build_maf(theta, x)

However, this density_estimator cannot currently be passed to NPE. Instead, it can currently only be used with the "Training interface".

I suggest that---maybe only for v1.0---we deprecate posterior_nn and instead require that NPE(density_estimator) is a DensityEstimator, not a Callable that builds a DensityEstimator. Alternatively, we could allow both (Union[Callable, DensityEstimator ]) .

Metadata

Metadata

Assignees

No one assigned

    Labels

    API changesThis impacts the public API of the project (e.g. inference class).architectureInternal changes without API consequencesdensity_estimators

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions