Giter Site home page Giter Site logo

Comments (9)

yebai avatar yebai commented on August 25, 2024 3

Maybe standardize the compiler API for LHS with concrete values, by e.g. introducing a function operate on Julia expressions (which can be called by the @model macro)? This would allow the user to overload ~ for specific use cases.

from dynamicppl.jl.

xukai92 avatar xukai92 commented on August 25, 2024

Reported by @jonasmac16.

from dynamicppl.jl.

mohamed82008 avatar mohamed82008 commented on August 25, 2024

This is an interesting one, but may I ask how is supporting Inf as data useful?

from dynamicppl.jl.

xukai92 avatar xukai92 commented on August 25, 2024

It's for something like below

res = solve(...)
if res.success
    data ~ dist
else
    Inf ~ dist
end

from dynamicppl.jl.

mohamed82008 avatar mohamed82008 commented on August 25, 2024

Can we achieve the same goal by defining the Impossible distribution? rand(::Impossible) = NaN and logpdf(::Impossible, ::Any) = -Inf.

res = solve(...)
if res.success
    data ~ dist
else
    data ~ Impossible()
end

Supporting Inf on the LHS is also possible.

from dynamicppl.jl.

xukai92 avatar xukai92 commented on August 25, 2024

Yes there are maily work aournds for this. Like the one you post or just pass in a data call data_inf which is Inf. But it's might be cool for the user to do so easily.

from dynamicppl.jl.

mohamed82008 avatar mohamed82008 commented on August 25, 2024

Sounds good.

from dynamicppl.jl.

devmotion avatar devmotion commented on August 25, 2024

As discussed in #57 (comment), I think the more natural way to write the example above would be

res = solve(...)
if !res.success
	@logpdf() = -Inf
	return
end

data ~ dist

So can this issue be closed, @xukai92, or are there other use cases that require a specific fix for Inf?

from dynamicppl.jl.

xukai92 avatar xukai92 commented on August 25, 2024

It makes sense. The issue was originally rasied by a user in slack. Let's close if for now.

from dynamicppl.jl.

Related Issues (20)

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.