Replies: 2 comments
-
A possible solution to this, which could keep purity + referential transparency, would be to allow an optional "name" argument to distributions, like:
Which is syntactic sugar for
If the argument is not defined, it is assumed that the distribution is independent to all other distributions. Could be quite a bit past alpha |
Beta Was this translation helpful? Give feedback.
-
Some of this (with sampleSet distributions) will be addressed here: @umuro said that it will be fixed with the upcoming Function functionality.
However, we do need a larger solution, and this will be more tricky, as you point out. SampleSet distributions can address this easily enough, as the samples can be ordered. However, it's not clear how we can best do this for symbolic+pointSet distributions. |
Beta Was this translation helpful? Give feedback.
-
I just stumbled across a relatively large issue that we need to have a discussion about at some point:
I'm not sure what we should do about some of the semantics of these distributions. Say for instance:
normal(0, 1) - normal(0, 1)
Should probably return
normal(0, sqrt(2))
as it currently does.The only awkward thing is now, if I was to define a variable
x
:I feel intuitively, I would expect the answer to be
0
. Because the distributions are not independent. The current version of squiggle disagrees with me, and returns the same answer as above.I have a practical example of this problem when creating the GiveDirectly model:
(Please ignore the
normalize
expressions, it's an artefact of working around #294). Here what I mean is the two references tobaseline_consumption
inlog_increase_in_initial_consumption
are not independent. Squiggle assumes they are, and gives the following result:What squiggle has output is nonsense to me, because it gives a decent probability mass on giving money to people actually decreasing their consumption!
My intuition is that we should fix this, and the above expression should not have any probability mass below 0. This has an obvious problem, which is my intuition violates referential transparency. It would mean that squiggle is no longer an actually pure language.
If I were to implement my intuition, then a number of changes would likely have to happen:
normal(5, 2)
would have to be impure functions, and return a unique identifier with each call.If anyone can come up with a way to talk about distributions that are not interdependent without breaking referential transparency, I'd love to know!
Beta Was this translation helpful? Give feedback.
All reactions