Closed rakaar closed 5 hours ago
Hi @rakaar thanks for reporting this. Are you using MAF as density estimator? When applied to one-dimensional parameter (data) spaces, MAF amounts to fitting a Gaussian.
If you are using MAF, can you please run it again with density_estimator="nsf"
and show the plots?
Cheers, Jan
@janfb
Thank you so much for the quick reply!
The likelihood is now much better with NSF Density Estimator!
Also, wouldn't it be nice to also "NSF" as default density estimator for SNLE?, because people come to SBI for complicated distributions, and a simple gaussian fit would most likely fail.
Glad that this worked!
The exact choice of density estimator really depends on the problem at hand. For example, for a 2-D example, MAF probably works similarly well.
In fact, you should have received a warning when using MAF with 1-D distributions. Did you receive this warning?
Yes. I saw the warning now. Sorry, didn't notice it.
But wouldn't it be better to change density_estimator to NSF, if using SNLE with 1D automatically in the library and log(print) it? I can submit a Pull Request with including this in documentation if you are ok with the idea .
As NSF also has its downside, e.g., it tends to be slower to train, I believe that keeping MAF as the default and raising a warning is a good solution here.
@michaeldeistler what do you think?
yes I am also leaning towards sticking with MAF.
OK, I will close to issue then. Thanks for offering help with implementing this @rakaar! We would be happy to get your help with other features in the future 🙏
Describe the bug SNLE not working, always estimate gaussian on even on toy examples like Beta, Gamma distributions
To Reproduce Please add a minimal code example that reproduces the problem:
Python version - 3.10.12 and SBI version: 0.23.2
Minimal code example: Python Notebooks with SNLE tried on Gamma and Beta Distribution
[Optional]: error message
Expected behavior SNLE should be able to estimate the likelihood correctly after Neural network training has converged
Additional context Add any other context about the problem here.