Skip to content

Commit

Permalink
remove AD code, update docs, bump to 2.0 (#99)
Browse files Browse the repository at this point in the history
* remove AD code, update docs, bump to 2.0
  • Loading branch information
tpapp authored Dec 7, 2022
1 parent d4f03be commit e961ac2
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 545 deletions.
18 changes: 2 additions & 16 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
name = "LogDensityProblems"
uuid = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
authors = ["Tamas K. Papp <[email protected]>"]
version = "1.0.3"
version = "2.0.0"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"

[compat]
ArgCheck = "1, 2"
BenchmarkTools = "1"
DocStringExtensions = "0.8, 0.9"
Requires = "0.5, 1"
UnPack = "0.1, 1"
julia = "1.6"

[extras]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
DiffResults = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["BenchmarkTools", "Distributions", "Documenter", "ForwardDiff", "Pkg", "ReverseDiff", "StatsBase", "StatsFuns", "Test", "Tracker", "Zygote"]
test = ["Test"]
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ A common framework for implementing and using log densities for inference, provi

1. The [`logdensity`](https://tamaspapp.eu/LogDensityProblems.jl/dev/#LogDensityProblems.logdensity) method with corresponding interface, which can be used by other packages that operate on (log) densities and need to evaluate the log densities or the gradients (eg [MCMC](https://en.wikipedia.org/wiki/Markov_chain_Monte_Carlo), [MAP](https://en.wikipedia.org/wiki/Maximum_a_posteriori_estimation), [ML](https://en.wikipedia.org/wiki/Maximum_likelihood_estimation) or similar methods).

2. The [`ADgradient`](https://tamaspapp.eu/LogDensityProblems.jl/dev/#LogDensityProblems.ADgradient) which makes objects that support `logdensity` to calculate log density *values* calculate log density *gradients* using various automatic differentiation packages.

3. Various utility functions for debugging and testing log densities.
2. Various utility functions for debugging and testing log densities.

**NOTE** As of version 1.0, transformed log densities have been moved to [TransformedLogDensities.jl](https://github.com/tpapp/TransformedLogDensities.jl). Existing code that uses `TransformedLogDensity` should add
```
using TransformedLogDensities
```
or equivalent.

**NOTE**: As of version 2.0, automatic differentiation backends have been moved to [https://github.com/tpapp/LogDensityProblemsAD.jl](https://github.com/tpapp/LogDensityProblemsAD.jl "LogDensityProblemsAD.jl"). If your code uses `ADgradient`, simply add
```julia
using LogDensityProblemsAD
```
or equivalent.

See the [documentation](https://tpapp.github.io/LogDensityProblems.jl/dev) for details.
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LogDensityProblemsAD = "996a588d-648d-4e1f-a8f0-a84b347e47b1"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
TransformVariables = "84d833dd-6860-57f9-a1a7-6da5db126cff"
TransformedLogDensities = "f9bc47f6-f3f8-4f3b-ab21-f8bc73906f26"
Expand Down
3 changes: 2 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Documenter, LogDensityProblems, ForwardDiff, Tracker, Zygote, BenchmarkTools, TransformedLogDensities
using Documenter, LogDensityProblems, ForwardDiff, Tracker, Zygote, BenchmarkTools,
TransformedLogDensities, LogDensityProblemsAD

makedocs(
sitename = "LogDensityProblems.jl",
Expand Down
10 changes: 5 additions & 5 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,20 @@ Here we use the exponential function to transform from ``\mathbb{R}`` to the pos

## Automatic differentiation

Using either definition, you can now transform to another object which is capable of evaluating the *gradient*, using automatic differentiation. The wrapper for this is
```@docs
ADgradient
```
Using either definition, you can transform to another object which is capable of evaluating the *gradient*, using automatic differentiation. For this, you need the [LogDensityProblemsAD.jl](https://github.com/tpapp/LogDensityProblemsAD.jl) package.

Now observe that we can obtain gradients, too:
```@repl 1
import ForwardDiff
using LogDensityProblemsAD
∇ℓ = ADgradient(:ForwardDiff, ℓ)
LogDensityProblems.capabilities(∇ℓ)
LogDensityProblems.logdensity_and_gradient(∇ℓ, zeros(2))
```

!!! note
Before version 2.0, `ADgradient` was part of this package. To update older code, just add `using LogDensityProblemsAD`.

## Manually calculated derivatives

If you prefer not to use automatic differentiation, you can wrap your own derivatives following the template
Expand Down Expand Up @@ -171,7 +172,6 @@ You may find these utilities useful for debugging and optimization.

```@docs
LogDensityProblems.stresstest
LogDensityProblems.benchmark_ForwardDiff_chunks
```

# [Log densities API](@id log-density-api)
Expand Down
61 changes: 0 additions & 61 deletions src/AD_Enzyme.jl

This file was deleted.

51 changes: 0 additions & 51 deletions src/AD_ForwardDiff.jl

This file was deleted.

60 changes: 0 additions & 60 deletions src/AD_ReverseDiff.jl

This file was deleted.

31 changes: 0 additions & 31 deletions src/AD_Tracker.jl

This file was deleted.

21 changes: 0 additions & 21 deletions src/AD_Zygote.jl

This file was deleted.

29 changes: 0 additions & 29 deletions src/DiffResults_helpers.jl

This file was deleted.

Loading

2 comments on commit e961ac2

@tpapp
Copy link
Owner Author

@tpapp tpapp commented on e961ac2 Dec 7, 2022

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/73660

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.0.0 -m "<description of version>" e961ac27c4d998f32d0f459ff8c14f5a80eac7f2
git push origin v2.0.0

Please sign in to comment.