stripe / rainier

Bayesian inference in Scala.
https://rainier.fit
Apache License 2.0
432 stars 51 forks source link

WIP: do not distribute over multiplications automatically #433

Closed avibryant closed 4 years ago

avibryant commented 4 years ago

Again on the theme of hoisting optimizations up into higher layers: previously, if we had something like (x+1)(x+2) + (y+1)(y+2) we would distribute out the multiplications before doing the sum. In the case that x=y, this will simplify nicely, but otherwise it just makes things worse.

Now, we never do this automatically, but added a distribute method to Real so you can request it if you know it will be a good idea.

avibryant commented 4 years ago

Marking this WIP because I'm realizing that it should distribute recursively instead of just the top-level LogLine.

andrew-stripe commented 4 years ago

Should I hold off reviewing for now then?

avibryant commented 4 years ago

@andrew-stripe yes, thanks - it's going to get hairier, might as well wait until then.

avibryant commented 4 years ago

closing this for now, will revisit later