probabilists / lampe Goto Github PK
View Code? Open in Web Editor NEWLikelihood-free AMortized Posterior Estimation with PyTorch
Home Page: https://lampe.readthedocs.io
License: MIT License
Likelihood-free AMortized Posterior Estimation with PyTorch
Home Page: https://lampe.readthedocs.io
License: MIT License
Implementation of Balanced Neural Ratio Estimation (BNRE) as introduced in "Towards Reliable Simulation-Based Inference with Balanced Neural Ratio Estimation" (Delaunoy et al., 2022)
An implementation of the BNRE loss similar to the NRELoss
None
The documentation of the build
constructor argument in NRE/NPE/NSE specifies
build: Callable[[int, int], nn.Module] = MLP
and
build: The network constructor
In my opinion, this does not really help in understanding how this constructor argument should be used, as there is no mention of what the ints are referring to. It is also not clear what the nn.Module
should expect as inputs and produce as outputs.
In the tutorial about embeddings, it could also be helpful to explain how the network produced with build
is different from the network used to build an embedding.
Given the recent popularity of score-based generative modeling, it would be great to provide a score-based inference algorithm within LAMPE.
A NSE
(neural score estimation) class, a NSELoss
module and a way to sample from the trained score estimator should be provided. Access to the log-density (through the probability flow ODE) is not mandatory, but would be convenient.
Deep Unsupervised Learning using Nonequilibrium Thermodynamics (Sohl-Dickstein et al., 2015)
https://arxiv.org/abs/1503.03585
Generative Modeling by Estimating Gradients of the Data Distribution (Song et al., 2019)
https://arxiv.org/abs/1907.05600
Denoising Diffusion Probabilistic Models (Ho et al., 2020)
https://arxiv.org/abs/2006.11239
Score-Based Generative Modeling through Stochastic Differential Equations (Song et al., 2021)
https://arxiv.org/abs/2011.13456
The method described in Calibrating Neural Simulation-Based Inference with Differentiable Coverage Probability paper.
New loss class in the inference
module, similar to the NRELoss ->BNRELoss enhancement.
Two separate classes, one for NRE, and one for NPE.
I did not consider alternatives.
The simulator tutorial references JointDataset
, which does not exist.
It should probably be updated to IterableJointDataset
or JointLoader
.
When the domain is one-dimensional, lampe.utils.gridapply
builds a grid of shape (bins,)
instead of the expected (bins, 1)
.
In the following error, mat1
is x
and should be of shape (128, 1)
.
>>> import torch
>>> import lampe
>>> A = torch.randn(1, 3)
>>> f = lambda x: x @ A
>>> domain = torch.zeros(1), torch.ones(1)
>>> lampe.utils.gridapply(f, domain)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/francois/Documents/Git/lampe/lampe/utils.py", line 104, in gridapply
y = [f(x) for x in grid.split(batch_size)]
File "/home/francois/Documents/Git/lampe/lampe/utils.py", line 104, in <listcomp>
y = [f(x) for x in grid.split(batch_size)]
File "<stdin>", line 1, in <lambda>
RuntimeError: mat1 and mat2 shapes cannot be multiplied (1x128 and 1x3)
The grid should be of shape (bins, 1)
.
The lampe.utils.gridapply
function uses torch.cartesian_prod
, which behaves inconsistently when given a single argument. A reshape
should be enough to fix the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.