Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to AutoDiffOperators v0.2 #453

Merged
merged 2 commits into from
Oct 7, 2024
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
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "BAT"
uuid = "c0cd4b16-88b7-57fa-983b-ab80aecada7e"
version = "3.3.0"
version = "3.3.1"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down Expand Up @@ -95,7 +95,7 @@ AdvancedHMC = "0.5, 0.6"
AffineMaps = "0.2.3, 0.3"
ArgCheck = "1, 2.0"
ArraysOfArrays = "0.4, 0.5, 0.6"
AutoDiffOperators = "0.1"
AutoDiffOperators = "0.2"
ChainRulesCore = "0.9.44, 0.10, 1"
ChangesOfVariables = "0.1.1"
Clustering = "0.13, 0.14, 0.15"
Expand Down Expand Up @@ -135,7 +135,7 @@ Measurements = "2"
NamedArrays = "0.9, 0.10"
NestedSamplers = "0.8"
Optim = "0.19,0.20, 0.21, 0.22, 1"
Optimization = "3"
Optimization = "3, 4"
PDMats = "0.9, 0.10, 0.11"
ParallelProcessingTools = "0.4"
Parameters = "0.12, 0.13"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/list_of_algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ BAT sampling algorithm type: [`MCMCSampling`](@ref), MCMC algorithm subtype: [`H

```julia
import AdvancedHMC, ForwardDiff
set_batcontext(ad = ADModule(:ForwardDiff))
set_batcontext(ad = ADSelector(ForwardDiff))
bat_sample(target, MCMCSampling(mcalg = HamiltonianMC()))
```
Requires the [AdvancedHMC](https://github.com/TuringLang/AdvancedHMC.jl) Julia package to be loaded explicitly.
Expand Down Expand Up @@ -160,7 +160,7 @@ using Optim
bat_findmode(target, OptimAlg(optalg = Optim.NelderMead()))

import ForwardDiff
set_batcontext(ad = ADModule(:ForwardDiff))
set_batcontext(ad = ADSelector(ForwardDiff))
bat_findmode(target, OptimAlg(optalg = Optim.LBFGS()))
```

Expand Down
2 changes: 1 addition & 1 deletion examples/dev-internal/test_findmode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ using AutoDiffOperators
b = Optimization.SciMLBase.NoAD()
supertype(typeof(b))

adm = ADModule(:ForwardDiff)
adm = ADSelector(ForwardDiff)

adsel = BAT.get_adselector(context)
supertype(typeof(adsel))
Expand Down
2 changes: 1 addition & 1 deletion examples/paper-example/paper_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Cuba, AdvancedHMC, ForwardDiff
using AutoDiffOperators
#using AHMI

BAT.set_batcontext(ad = ADModule(:ForwardDiff))
BAT.set_batcontext(ad = ADSelector(ForwardDiff))


function log_pdf_poisson(λ::T, k::U) where {T<:Real,U<:Real}
Expand Down
2 changes: 1 addition & 1 deletion test/distributions/test_hierarchical_distribution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AdvancedHMC


@testset "hierarchial_distribution" begin
context = BATContext(ad = ADModule(:ForwardDiff))
context = BATContext(ad = ADSelector(ForwardDiff))

let
primary_dist = NamedTupleDist(
Expand Down
2 changes: 1 addition & 1 deletion test/measures/test_bat_pushfwd_measure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using Optim


@testset "bat_pushfwd_measure" begin
context = BATContext(ad = ADModule(:ForwardDiff))
context = BATContext(ad = ADSelector(ForwardDiff))

@testset "distribution transforms" begin
function test_uv_transformed(target_type::Type{<:Distribution}, source_dist::Distribution)
Expand Down
2 changes: 1 addition & 1 deletion test/optimization/test_mode_estimators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ using Optim, OptimizationOptimJL
end

@testset "Optim.jl - LBFGS" begin
context = BATContext(rng = Philox4x((0, 0)), ad = ADModule(:ForwardDiff))
context = BATContext(rng = Philox4x((0, 0)), ad = ADSelector(ForwardDiff))
# Result Optim.maximize with LBFGS is not type-stable:
test_findmode(posterior, OptimAlg(optalg = LBFGS(), trafo = DoNotTransform()), 0.01, inferred = false, context)

Expand Down
4 changes: 2 additions & 2 deletions test/samplers/mcmc/test_hmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ForwardDiff, Zygote
import AdvancedHMC

@testset "HamiltonianMC" begin
context = BATContext(ad = ADModule(:ForwardDiff))
context = BATContext(ad = ADSelector(ForwardDiff))
objective = NamedTupleDist(a = Normal(1, 1.5), b = MvNormal([-1.0, 2.0], [2.0 1.5; 1.5 3.0]))

shaped_target = @inferred(batmeasure(objective))
Expand Down Expand Up @@ -143,7 +143,7 @@ import AdvancedHMC
@testset "HMC autodiff" begin
posterior = BAT.example_posterior()

for adsel in [ADModule(:ForwardDiff), ADModule(:Zygote)]
for adsel in [ADSelector(ForwardDiff), ADSelector(Zygote)]
@testset "$adsel" begin
context = BATContext(ad = adsel)

Expand Down
Loading