-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does @model build a declaration instead of a value? #667
Comments
Hi Chad, Thanks for the issue. In Turing, defining @model f(x, y) = begin
....
end or the less common: @model function f(x,y)
...
end are supported. In fact any named function definition syntax is supported. It should also be trivial to support the syntax: @model (x, y) -> begin
....
end or even the Soss syntax: @model (x, y) begin
....
end in the future. It is just a matter of assigning some g = @model f(x, y) = begin
...
end where Regarding inlining, if by inlining, you mean inlining the
Note that we can sprinkle Regarding first class models and defining things like |
I will close this issue for now. As for using models as drop-in for distributions, I think a separate API can be used to create a distribution from the model generator. I will think more about this after I move the Turing compiler to DynamicPPL and try to make Turing and Soss interoperable. |
Hello Turing,
I'm curious about the design decision to make
@model
return a declaration instead of a value. For example, turing.ml has this example:In Soss.jl I would write this as
We can think of Soss's
@model
as being "anonymous", similar to an anonymous function. I see a few advantages to the latter approach:myModel = @model...
sample(gdemo(1.5, 2), SMC(1000))
,gdemo
could be replaced with@model...
code@model...
in place of (for example)Normal()
This makes me wonder, was having
@model
be a declaration a conscious design choice, or was the alternative not discussed? What benefits do you see from this approach? Is there any possibility of this changing at some point, or has it become too strong a dependency?The text was updated successfully, but these errors were encountered: