Add interface for Zuko density estimators 🔥
Is your feature request related to a problem? Please describe.
Given the new DensityEstimator setup (#952 , #965) we can now start implementing new density estimators.
Describe the solution you'd like
For example: analog to the NflowsFlow class there could be a class for Zuko flows. Such a class needs to inherit from DensityEstimator and implements its methods. For Zuko flows, most of them are there already, but not all. E.g., the loss needs to implemented, and the condition_shape needs to be passed at init.
Additional context, plan:
- Have a look at how the
NflowsFlowis used in our API (see tests): https://github.com/sbi-dev/sbi/blob/17f3033aa55514ac6c039da729ee84ce32eb20d9/tests/density_estimator_test.py#L47-L61 - Check out how
Zukoflows are used in thelampeAPI: https://github.com/probabilists/lampe/blob/3e88c8e101e55b5689209470e60ddcb4e4962d1d/lampe/inference/npe.py#L71 This is how one could compute the loss for theDensityEstimatorAPI (should be agnostic toxvstheta). - implement
ZukoFlowsas new density estimator interface - add tests in
density_estimator_test.py
ZukoFlow is now available as a subclass of DensityEstimator, along with an example builder function build_zuko_maf!
Would now be good to add different flow types supported by Zuko following this structure (along with api tests).
It seems like some work has begun here? I will add myself to help continue the integration.
I would also like to add myself to help continue the integration with Zuko!
solved via #1116