Skip to content

Conversation

penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented May 9, 2025

generated_quantities was deprecated quite a few DPPL versions ago, so I replaced it with returned, and also added a section talking about :=.

Also replaced TuringBenchmarking with in-house DPPL benchmarking.

Also removed Zygote from the list of 'officially supported'. Technically, this would have been done in #595, but I'm slow on getting that merged.

Also added a reference to ADTests.

Also fixed some other dead links.

Copy link
Contributor

github-actions bot commented May 9, 2025

Preview the changes: https://turinglang.org/docs/pr-previews/599
Please avoid using the search feature and navigation bar in PR previews!

@penelopeysm penelopeysm requested a review from mhauru May 11, 2025 23:54
Copy link
Member

@mhauru mhauru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, only a couple of optional-to-attend-to suggestions.

@penelopeysm penelopeysm requested a review from mhauru May 12, 2025 21:28
@penelopeysm
Copy link
Member Author

penelopeysm commented May 12, 2025

Moving on, we generate samples from the posterior using the default NUTS sampler. We’ll make use of ReverseDiff.jl, as it has better performance than ForwardDiff.jl on this example. See Turing.jl’s docs on Automatic Differentiation for more info.

I just benchmarked this one, interesting - cc @willtebbutt as you might like this example where Mooncake absolutely blows RD out of the water

distances = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
ns = [1443, 694, 455, 353, 272, 256, 240, 217, 200, 237, 202, 192, 174, 167, 201, 195, 191, 147, 152, ]
ys = [1346, 577, 337, 208, 149, 136, 111, 69, 67, 75, 52, 46, 54, 28, 27, 31, 33, 20, 24]

using AbstractGPs, LogExpFunctions, Turing
@model function putting_model(d, n; jitter=1e-4)
    v ~ Gamma(2, 1)
    l ~ Gamma(4, 1)
    f = GP(v * with_lengthscale(SEKernel(), l))
    f_latent ~ f(d, jitter)
    y ~ product_distribution(Binomial.(n, logistic.(f_latent)))
    return (fx=f(d, jitter), f_latent=f_latent, y=y)
end
m = putting_model(Float64.(distances), ns)

ForwardDiff 17.60233918128655
ReverseDiff 120.82069565217394
ReverseDiffCompiled 31.189760856427522
Mooncake 5.9673639441020745

(Enzyme forward and reverse both error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants