Coder Social home page Coder Social logo

wangbingjie / sbi_pp Goto Github PK

View Code? Open in Web Editor NEW
23.0 4.0 1.0 503 KB

Simulation-based (likelihood-free) inference customized for astronomical applications

License: MIT License

Python 6.52% Jupyter Notebook 93.48%
sed-fitting simulation-based-inference

sbi_pp's Issues

Missing band-passes

Hi all,

@jrleja @joshspeagle pointed me here.

Thank you for this repository.

I was able to train a SED model with it, but cannot do inference with it yet.

I am confused about this line:
anpe._x_shape = Ut.x_shape_from_simulation(y_tensor)
which causes a "AssertionError: Observed data shape (torch.Size([1, 33])) must match the shape of simulated data x (torch.Size([1, 29]))." for me when doing:

            x = np.concatenate([y_obs, sig_obs])
            ave_theta = hatp_x_y.sample((run_params['np_baseline'],), x=torch.as_tensor(x.astype(np.float32)).to(device), show_progress_bars=False)

I would expect that hatp_x_y._x_shape has to take the shape of x_tensor[0], given that we insert data values and want posteriors of shape of the parameters, but it is set to the latter?

Secondly, I was wondering about an alternative approach to deal with missing values, namely to set fluxes and errors to some special negative value (e.g. -1) randomly (proportional to their missing fraction) and train with such a modified data set, or introduce an additional indicator vector {0, 1} that indicates whether the observation is present. Then one would not need MC later (which requires ordering of a 1d data set and assumption that there are no strong emission/absorption lines). Have you tried this approach and dismissed it for some reason, does it not work? It seems to me that it would need fewer code lines.

Finally, if I see well, this code is a wrapper around
https://www.mackelab.org/sbi/reference/#sbi.inference.snpe.snpe_c.SNPE_C
and adds handling missing data.
It would be good to encourage users to also cite the original work on SNPE_C listed there and perhaps other foundation papers.
For an example of a suggested list of references, see https://johannesbuchner.github.io/UltraNest/issues.html#how-should-i-cite-ultranest

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.