-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved particle filter error message. (#900)
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Turing, Random, Test | ||
using StatsFuns | ||
|
||
dir = splitdir(splitdir(pathof(Turing))[1])[1] | ||
include(dir*"/test/test_utils/AllUtils.jl") | ||
|
||
@turing_testset "smc.jl" begin | ||
@model normal() = begin | ||
a ~ Normal(4,5) | ||
3 ~ Normal(a,2) | ||
b ~ Normal(a,1) | ||
1.5 ~ Normal(b,2) | ||
a, b | ||
end | ||
|
||
tested = sample(normal(), SMC(), 100); | ||
|
||
# failing test | ||
@model fail_smc() = begin | ||
a ~ Normal(4,5) | ||
3 ~ Normal(a,2) | ||
b ~ Normal(a,1) | ||
if a >= 4.0 | ||
1.5 ~ Normal(b,2) | ||
end | ||
a, b | ||
end | ||
|
||
@test_throws ErrorException sample(fail_smc(), SMC(), 100) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters