Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:
test:
# Run some of the slower test files individually. The last one catches everything
# not included in the others.
- name: "essential/ad"
args: "essential/ad.jl"
- name: "mcmc/gibbs"
args: "mcmc/gibbs.jl"
- name: "mcmc/hmc"
Expand All @@ -37,7 +35,7 @@ jobs:
- name: "mcmc/ess"
args: "mcmc/ess.jl"
- name: "everything else"
args: "--skip essential/ad.jl mcmc/gibbs.jl mcmc/hmc.jl mcmc/abstractmcmc.jl mcmc/Inference.jl mcmc/ess.jl"
args: "--skip mcmc/gibbs.jl mcmc/hmc.jl mcmc/abstractmcmc.jl mcmc/Inference.jl mcmc/ess.jl"
runner:
# Default
- version: '1'
Expand Down
41 changes: 41 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
# Release 0.37.0

## Breaking changes

### Gibbs constructors

0.37 removes the old Gibbs constructors deprecated in 0.36.

### Remove Zygote support

Zygote is no longer officially supported as an automatic differentiation backend, and `AutoZygote` is no longer exported. You can continue to use Zygote by importing `AutoZygote` from ADTypes and it may well continue to work, but it is no longer tested and no effort will be expended to fix it if something breaks.

[Mooncake](https://github.com/compintell/Mooncake.jl/) is the recommended replacement for Zygote.

### DynamicPPL 0.35

Turing.jl v0.37 uses DynamicPPL v0.35, which brings with it several breaking changes:

- The right hand side of `.~` must from now on be a univariate distribution.
- Indexing `VarInfo` objects by samplers has been removed completely.
- The order in which nested submodel prefixes are applied has been reversed.
- The arguments for the constructor of `LogDensityFunction` have changed. `LogDensityFunction` also now satisfies the `LogDensityProblems` interface, without needing a wrapper object.

For more details about all of the above, see the changelog of DynamicPPL [here](https://github.com/TuringLang/DynamicPPL.jl/releases/tag/v0.35.0).

### Export list

Turing.jl's export list has been cleaned up a fair bit. This affects what is imported into your namespace when you do an unqualified `using Turing`. You may need to import things more explicitly than before.

- The `DynamicPPL` and `AbstractMCMC` modules are no longer exported. You will need to `import DynamicPPL` or `using DynamicPPL: DynamicPPL` (likewise `AbstractMCMC`) yourself, which in turn means that they have to be made available in your project environment.

- `@logprob_str` and `@prob_str` have been removed following a long deprecation period.
- We no longer re-export everything from `Bijectors` and `Libtask`. To get around this, add `using Bijectors` or `using Libtask` at the top of your script (but we recommend using more selective imports).

+ We no longer export `Bijectors.ordered`. If you were using `ordered`, even Bijectors does not (currently) export this. You will have to manually import it with `using Bijectors: ordered`.

On the other hand, we have added a few more exports:

- `DynamicPPL.returned` and `DynamicPPL.prefix` are exported (for use with submodels).
- `LinearAlgebra.I` is exported for convenience.

# Release 0.36.0

## Breaking changes
Expand Down
8 changes: 3 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Turing"
uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
version = "0.36.3"
version = "0.37.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand All @@ -23,7 +23,6 @@ ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Libtask = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
LogDensityProblemsAD = "996a588d-648d-4e1f-a8f0-a84b347e47b1"
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
NamedArrays = "86f7a689-2022-50b4-a561-43c23ac3c673"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
Expand Down Expand Up @@ -59,17 +58,16 @@ BangBang = "0.4.2"
Bijectors = "0.14, 0.15"
Compat = "4.15.0"
DataStructures = "0.18"
Distributions = "0.23.3, 0.24, 0.25"
Distributions = "0.25.77"
DistributionsAD = "0.6"
DocStringExtensions = "0.8, 0.9"
DynamicHMC = "3.4"
DynamicPPL = "0.34.1"
DynamicPPL = "0.35"
EllipticalSliceSampling = "0.5, 1, 2"
ForwardDiff = "0.10.3"
Libtask = "0.8.8"
LinearAlgebra = "1"
LogDensityProblems = "2"
LogDensityProblemsAD = "1.7.0"
MCMCChains = "5, 6"
NamedArrays = "0.9, 0.10"
Optim = "1"
Expand Down
3 changes: 0 additions & 3 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[deps]
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
13 changes: 5 additions & 8 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
using Documenter
using Turing
# Need to import Distributions and Bijectors to generate docs for functions
# from those packages.
using Distributions
using Bijectors
using DynamicPPL

using DocumenterInterLinks

links = InterLinks(
"DynamicPPL" => "https://turinglang.org/DynamicPPL.jl/stable/objects.inv",
"AbstractPPL" => "https://turinglang.org/AbstractPPL.jl/dev/objects.inv",
"AbstractPPL" => "https://turinglang.org/AbstractPPL.jl/stable/objects.inv",
"LinearAlgebra" => "https://docs.julialang.org/en/v1/objects.inv",
"AbstractMCMC" => "https://turinglang.org/AbstractMCMC.jl/stable/objects.inv",
"ADTypes" => "https://sciml.github.io/ADTypes.jl/stable/objects.inv",
"AdvancedVI" => "https://turinglang.org/AdvancedVI.jl/v0.2.8/objects.inv",
"DistributionsAD" => "https://turinglang.org/DistributionsAD.jl/stable/objects.inv",
"OrderedCollections" => "https://juliacollections.github.io/OrderedCollections.jl/stable/objects.inv",
)

# Doctest setup
DocMeta.setdocmeta!(Turing, :DocTestSetup, :(using Turing); recursive=true)

makedocs(;
sitename="Turing",
modules=[Turing, Distributions, Bijectors],
modules=[Turing],
pages=[
"Home" => "index.md",
"API" => "api.md",
"Submodule APIs" =>
["Inference" => "api/Inference.md", "Optimisation" => "api/Optimisation.md"],
],
checkdocs=:exports,
# checkdocs_ignored_modules=[Turing, Distributions, DynamicPPL, AbstractPPL, Bijectors],
doctest=false,
warnonly=true,
plugins=[links],
Expand Down
76 changes: 32 additions & 44 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ Turing.jl directly re-exports the entire public API of the following packages:

- [Distributions.jl](https://juliastats.org/Distributions.jl)
- [MCMCChains.jl](https://turinglang.org/MCMCChains.jl)
- [AbstractMCMC.jl](https://turinglang.org/AbstractMCMC.jl)
- [Bijectors.jl](https://turinglang.org/Bijectors.jl)
- [Libtask.jl](https://github.com/TuringLang/Libtask.jl)

Please see the individual packages for their documentation.

## Individual exports and re-exports

**All** of the following symbols are exported unqualified by Turing, even though the documentation suggests that many of them are qualified.
In this API documentation, for the sake of clarity, we have listed the module that actually defines each of the exported symbols.
Note, however, that **all** of the following symbols are exported unqualified by Turing.
That means, for example, you can just write

```julia
Expand All @@ -37,17 +35,22 @@ even though [`Prior()`](@ref) is actually defined in the `Turing.Inference` modu

### Modelling

| Exported symbol | Documentation | Description |
|:--------------- |:----------------------------------- |:-------------------------------------------- |
| `@model` | [`DynamicPPL.@model`](@extref) | Define a probabilistic model |
| `@varname` | [`AbstractPPL.@varname`](@extref) | Generate a `VarName` from a Julia expression |
| `to_submodel` | [`DynamicPPL.to_submodel`](@extref) | Define a submodel |
| Exported symbol | Documentation | Description |
|:-------------------- |:------------------------------------------ |:-------------------------------------------------------------------------------------------- |
| `@model` | [`DynamicPPL.@model`](@extref) | Define a probabilistic model |
| `@varname` | [`AbstractPPL.@varname`](@extref) | Generate a `VarName` from a Julia expression |
| `to_submodel` | [`DynamicPPL.to_submodel`](@extref) | Define a submodel |
| `prefix` | [`DynamicPPL.prefix`](@extref) | Prefix all variable names in a model with a given symbol |
| `LogDensityFunction` | [`DynamicPPL.LogDensityFunction`](@extref) | A struct containing all information about how to evaluate a model. Mostly for advanced users |

### Inference

| Exported symbol | Documentation | Description |
|:--------------- |:------------------------------------------------------------------------------------------------ |:------------------- |
| `sample` | [`StatsBase.sample`](https://turinglang.org/AbstractMCMC.jl/stable/api/#Sampling-a-single-chain) | Sample from a model |
| Exported symbol | Documentation | Description |
|:----------------- |:------------------------------------------------------------------------------------------------ |:---------------------------------- |
| `sample` | [`StatsBase.sample`](https://turinglang.org/AbstractMCMC.jl/stable/api/#Sampling-a-single-chain) | Sample from a model |
| `MCMCThreads` | [`AbstractMCMC.MCMCThreads`](@extref) | Run MCMC using multiple threads |
| `MCMCDistributed` | [`AbstractMCMC.MCMCDistributed`](@extref) | Run MCMC using multiple processes |
| `MCMCSerial` | [`AbstractMCMC.MCMCSerial`](@extref) | Run MCMC using without parallelism |

### Samplers

Expand All @@ -68,6 +71,7 @@ even though [`Prior()`](@ref) is actually defined in the `Turing.Inference` modu
| `SMC` | [`Turing.Inference.SMC`](@ref) | Sequential Monte Carlo |
| `PG` | [`Turing.Inference.PG`](@ref) | Particle Gibbs |
| `CSMC` | [`Turing.Inference.CSMC`](@ref) | The same as PG |
| `RepeatSampler` | [`Turing.Inference.RepeatSampler`](@ref) | A sampler that runs multiple times on the same variable |
| `externalsampler` | [`Turing.Inference.externalsampler`](@ref) | Wrap an external sampler for use in Turing |

### Variational inference
Expand All @@ -88,7 +92,6 @@ See the [AD guide](https://turinglang.org/docs/tutorials/docs-10-using-turing-au
|:----------------- |:------------------------------------ |:---------------------- |
| `AutoForwardDiff` | [`ADTypes.AutoForwardDiff`](@extref) | ForwardDiff.jl backend |
| `AutoReverseDiff` | [`ADTypes.AutoReverseDiff`](@extref) | ReverseDiff.jl backend |
| `AutoZygote` | [`ADTypes.AutoZygote`](@extref) | Zygote.jl backend |
| `AutoMooncake` | [`ADTypes.AutoMooncake`](@extref) | Mooncake.jl backend |

### Debugging
Expand All @@ -109,52 +112,37 @@ OrderedLogistic
LogPoisson
```

`BernoulliLogit` is part of Distributions.jl since version 0.25.77.
If you are using an older version of Distributions where this isn't defined, Turing will export the same distribution.

```@docs
Distributions.BernoulliLogit
```

### Tools to work with distributions

| Exported symbol | Documentation | Description |
|:--------------- |:-------------------------------------- |:-------------------------------------------------------------- |
| `I` | [`LinearAlgebra.I`](@extref) | Identity matrix |
| `filldist` | [`DistributionsAD.filldist`](@extref) | Create a product distribution from a distribution and integers |
| `arraydist` | [`DistributionsAD.arraydist`](@extref) | Create a product distribution from an array of distributions |
| `NamedDist` | [`DynamicPPL.NamedDist`](@extref) | A distribution that carries the name of the variable |

### Predictions

```@docs
DynamicPPL.predict
```
| Exported symbol | Documentation | Description |
|:--------------- |:--------------------------------------------------------------------------------- |:------------------------------------------------------- |
| `predict` | [`StatsAPI.predict`](https://turinglang.org/DynamicPPL.jl/stable/api/#Predicting) | Generate samples from posterior predictive distribution |

### Querying model probabilities and quantities

Please see the [generated quantities](https://turinglang.org/docs/tutorials/usage-generated-quantities/) and [probability interface](https://turinglang.org/docs/tutorials/usage-probability-interface/) guides for more information.

| Exported symbol | Documentation | Description |
|:-------------------------- |:--------------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------------------------------- |
| `generated_quantities` | [`DynamicPPL.generated_quantities`](@extref) | Calculate additional quantities defined in a model |
| `pointwise_loglikelihoods` | [`DynamicPPL.pointwise_loglikelihoods`](@extref) | Compute log likelihoods for each sample in a chain |
| `logprior` | [`DynamicPPL.logprior`](@extref) | Compute log prior probability |
| `logjoint` | [`DynamicPPL.logjoint`](@extref) | Compute log joint probability |
| `LogDensityFunction` | [`DynamicPPL.LogDensityFunction`](@extref) | Wrap a Turing model to satisfy LogDensityFunctions.jl interface |
| `condition` | [`AbstractPPL.condition`](@extref) | Condition a model on data |
| `decondition` | [`AbstractPPL.decondition`](@extref) | Remove conditioning on data |
| `conditioned` | [`DynamicPPL.conditioned`](@extref) | Return the conditioned values of a model |
| `fix` | [`DynamicPPL.fix`](@extref) | Fix the value of a variable |
| `unfix` | [`DynamicPPL.unfix`](@extref) | Unfix the value of a variable |
| `OrderedDict` | [`OrderedCollections.OrderedDict`](https://juliacollections.github.io/OrderedCollections.jl/dev/ordered_containers/#OrderedDicts) | An ordered dictionary |

### Extra re-exports from Bijectors

Note that Bijectors itself does not export `ordered`.

```@docs
Bijectors.ordered
```
| Exported symbol | Documentation | Description |
|:-------------------------- |:---------------------------------------------------------------------------------------------------------------------------- |:-------------------------------------------------- |
| `returned` | [`DynamicPPL.returned`](https://turinglang.org/DynamicPPL.jl/stable/api/#DynamicPPL.returned-Tuple%7BModel,%20NamedTuple%7D) | Calculate additional quantities defined in a model |
| `pointwise_loglikelihoods` | [`DynamicPPL.pointwise_loglikelihoods`](@extref) | Compute log likelihoods for each sample in a chain |
| `logprior` | [`DynamicPPL.logprior`](@extref) | Compute log prior probability |
| `logjoint` | [`DynamicPPL.logjoint`](@extref) | Compute log joint probability |
| `condition` | [`AbstractPPL.condition`](@extref) | Condition a model on data |
| `decondition` | [`AbstractPPL.decondition`](@extref) | Remove conditioning on data |
| `conditioned` | [`DynamicPPL.conditioned`](@extref) | Return the conditioned values of a model |
| `fix` | [`DynamicPPL.fix`](@extref) | Fix the value of a variable |
| `unfix` | [`DynamicPPL.unfix`](@extref) | Unfix the value of a variable |
| `OrderedDict` | [`OrderedCollections.OrderedDict`](@extref) | An ordered dictionary |

### Point estimates

Expand Down
Loading
Loading