Skip to content

Commit 2dc6341

Browse files
authored
Restrict tests to FillArrays 1.0.0 (#2014)
* restrict tests to FillArrays 1.0.0 * fixed compat bound to FillArrays in Turing * fixed test for HMC on prior model
1 parent 6a307cd commit 2dc6341

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name = "Turing"
22
uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
33
version = "0.26.0"
44

5-
65
[deps]
76
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
87
AdvancedHMC = "0bf59076-c3b1-5ca4-86bd-e02cd72cde3d"
@@ -17,6 +16,7 @@ DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c"
1716
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1817
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
1918
EllipticalSliceSampling = "cad2338a-1db2-11e9-3401-43bc07c9ede2"
19+
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
2020
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
2121
Libtask = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f"
2222
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -50,6 +50,7 @@ DistributionsAD = "0.6"
5050
DocStringExtensions = "0.8, 0.9"
5151
DynamicPPL = "0.23"
5252
EllipticalSliceSampling = "0.5, 1"
53+
FillArrays = "=1.0.0"
5354
ForwardDiff = "0.10.3"
5455
Libtask = "0.7, 0.8"
5556
LogDensityProblems = "2"

test/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
88
DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c"
99
DynamicHMC = "bbc10e6e-7c05-544b-b16e-64fede858acb"
1010
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
11+
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
1112
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
1213
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1314
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -41,6 +42,7 @@ Distributions = "0.25"
4142
DistributionsAD = "0.6.3"
4243
DynamicHMC = "2.1.6, 3.0"
4344
DynamicPPL = "0.23"
45+
FillArrays = "=1.0.0"
4446
FiniteDifferences = "0.10.8, 0.11, 0.12"
4547
ForwardDiff = "0.10.12 - 0.10.32, 0.10"
4648
LogDensityProblems = "2"

test/inference/hmc.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,16 @@
218218
end
219219

220220
@turing_testset "prior" begin
221+
@model function demo_hmc_prior()
222+
# NOTE: Used to use `InverseGamma(2, 3)` but this has infinite variance
223+
# which means that it's _very_ difficult to find a good tolerance in the test below:)
224+
s ~ truncated(Normal(3, 1), lower=0)
225+
m ~ Normal(0, sqrt(s))
226+
end
221227
alg = NUTS(1000, 0.8)
222-
gdemo_default_prior = DynamicPPL.contextualize(gdemo_default, DynamicPPL.PriorContext())
228+
gdemo_default_prior = DynamicPPL.contextualize(demo_hmc_prior(), DynamicPPL.PriorContext())
223229
chain = sample(gdemo_default_prior, alg, 10_000)
224-
check_numerical(chain, [:s, :m], [mean(InverseGamma(2, 3)), 0], atol=0.45)
230+
check_numerical(chain, [:s, :m], [mean(truncated(Normal(3, 1); lower=0)), 0], atol=0.1)
225231
end
226232

227233
@turing_testset "warning for difficult init params" begin

0 commit comments

Comments
 (0)