You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: usage/automatic-differentiation/index.qmd
+3-3
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Pkg.instantiate();
14
14
15
15
## What is Automatic Differentiation?
16
16
17
-
Automatic differentiation (AD) is a technique used to evaluate the derivative of a function at a given set of arguments.
17
+
Automatic differentiation (AD) is a technique used in Turing.jl to evaluate the gradient of a function at a given set of arguments.
18
18
In the context of Turing.jl, the function being differentiated is the log probability density of a model, and the arguments are the parameters of the model (i.e. the values of the random variables).
19
19
The gradient of the log probability density is used by various algorithms in Turing.jl, such as HMC (including NUTS), mode estimation (which uses gradient-based optimization), and variational inference.
20
20
@@ -26,7 +26,7 @@ For example, to use the [Mooncake.jl](https://github.com/compintell/Mooncake.jl)
26
26
using Turing
27
27
setprogress!(false)
28
28
# Note that if you specify a custom AD backend, you must also import it.
29
-
using Mooncake
29
+
import Mooncake
30
30
31
31
@model function f()
32
32
x ~ Normal()
@@ -50,7 +50,7 @@ Turing.jl uses the functionality in [DifferentiationInterface.jl](https://github
50
50
Thus, in principle, any AD library that has integrations with DI can be used with Turing; you should consult the [DI documentation](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/stable/) for an up-to-date list of compatible AD libraries.
51
51
52
52
Note, however, that not all AD libraries in there are tested on Turing models.
53
-
Thus, it is likely that some of them will either error (because they don't know how to differentiate through Turing's code), or might silently give incorrect results.
53
+
Thus, it is likely that some of them will either error (because they don't know how to differentiate through Turing's code), or maybe even silently give incorrect results (if you are very unlucky).
54
54
55
55
Formally, our working model is that we have several _tiers_ of integration with AD libraries.
56
56
Generally, we recommend that users choose AD libraries that are in **Tier 2 or above**.
0 commit comments