Closed sethaxen closed 10 months ago
For some reason I haven't had any luck getting Stickbreaking with the log-simplex to be numerically stable.
For some reason I haven't had any luck getting Stickbreaking with the log-simplex to be numerically stable.
Turns out this was because the Jacobian determinant in the paper was off by an index. With the correct determinant, it works fine.
This PR also incorporates the changes in #72 and #73 but for the log-simplex.
The reference doc is here: https://mc-stan.org/docs/stan-users-guide/multi-indexing.html
Yes, it allocates an intermediate and copies. We're working on making it lazy with expression templates.
LGTM!
Following #65, this PR adds versions of our transforms for the log-simplex. It also adds a log-Dirichlet target.
Note that
LogDirichlet(log_x | alpha) = Dirichlet(exp(log_x) | α) * exp(sum(log_x[1:(N-1)]))
, while the Jacobian corrections in the transforms are adjusted byexp(-sum(log_x[1:(N-1)]))
, i.e. in the opposite direction.