Giter VIP home page Giter VIP logo

lampe's People

Contributors

adelau avatar bkmi avatar francois-rozet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lampe's Issues

Implement Balanced Neural Ratio Estimation loss

Description

Implementation of Balanced Neural Ratio Estimation (BNRE) as introduced in "Towards Reliable Simulation-Based Inference with Balanced Neural Ratio Estimation" (Delaunoy et al., 2022)

Implementation

An implementation of the BNRE loss similar to the NRELoss

Alternatives

None

Improve the `build` docstrings

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.

Implement a score-based inference algorithm

Description

Given the recent popularity of score-based generative modeling, it would be great to provide a score-based inference algorithm within LAMPE.

Interface

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.

References

Incorrect grid shape in `utils.gridapply` for one-dimensional space

Description

When the domain is one-dimensional, lampe.utils.gridapply builds a grid of shape (bins,) instead of the expected (bins, 1).

Reproduce

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)

Expected behavior

The grid should be of shape (bins, 1).

Causes and solution

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.

Environment

  • LAMPE version: 0.6.1
  • PyTorch version: 1.12.0
  • Python version: 3.9.15
  • OS: Ubuntu 22.10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.