Git Product home page Git Product logo

ma921 / sober Goto Github PK

View Code? Open in Web Editor NEW
21.0 2.0 2.0 33.95 MB

Fast Bayesian optimization, quadrature, inference over arbitrary domain with GPU parallel acceleration

License: BSD 3-Clause "New" or "Revised" License

Python 2.80% Jupyter Notebook 97.20%
bayesian-inference bayesian-optimization bayesian-quadrature blackbox-optimization drug-discovery quadrature simulation-based-inference global-optimization machine-learning optimization

sober's Issues

Bug: running BASQ sometimes fails if SOBER got too much training data

When running BASQ on a SOBER-optimized model for further calculations, sometimes a cryptic error shows up:

Traceback (most recent call last):
    MAP = basq.MAP(map_samples)
  File "sober/BASQ/_basq.py", line 135, in MAP
    samples = self.sampler.sample(n_samples)
  File "sober/_sampler.py", line 427, in sample
    samples = torch.vstack([samples_wkde, samples_prior])
RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 0 but got size 5 for tensor number 1 in the list.

I printed the shapes of samples_wkde and samples_prior (in that order) to look at what happens here. When everything runs well, the output looks like this:

Expected log marginal likelihood: 8.68782e+00
Variance log marginal likelihood: -1.30538e+01
torch.Size([995, 5]) torch.Size([0, 5])
torch.Size([39, 5]) torch.Size([0, 5])

This is when I only run one SOBER iteration. But when I run 10 iterations, afterwards the output is:

Expected log marginal likelihood: 7.21550e+00
Variance log marginal likelihood: -1.73687e+01
torch.Size([618, 5]) torch.Size([0, 5])
torch.Size([0]) torch.Size([0, 5])

Which obviously can't be stacked.

I have two questions. Why is samples_prior always empty? And why is samples_wkde sometimes shaped wrongly?

Settings to reproduce: run SOBER with the following sample sizes for 1 or 10 iterations:

  • 100 samples from the prior
  • sober.next_batch(10000, 100, 100)
    Then, run BASQ with the following sample sizes:
  • basq.quadrature(200, 5, 5)
  • basq.sampling_posterior(10)
  • basq.MAP(100)

How to define categorical variable with different ranges?

Assume I have a 4D categorical variable ranges in [[0,1], [0,1], [0,1,2,3,4], [0,1,2]], how should I define the categorical prior on this variable and pass into SOBER? As I know, each row in a torch.Tensor must has same dimesions.

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.