Skip to content

Commit

Permalink
Make doctest reproducible
Browse files Browse the repository at this point in the history
  • Loading branch information
sethaxen committed Dec 24, 2023
1 parent 17e08ed commit 1e3e96a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004"
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
MLJDecisionTreeInterface = "c6f25543-311c-4c74-83dc-3ea6d1015661"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"

[compat]
Expand All @@ -18,5 +19,6 @@ Gadfly = "1.3.4"
MCMCChains = "7"
MLJBase = "0.19, 0.20, 0.21, 1"
MLJDecisionTreeInterface = "0.3, 0.4"
StableRNGs = "1"
StatsPlots = "0.14, 0.15"
julia = "1.7"
12 changes: 7 additions & 5 deletions src/stats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,18 @@ Note that this will return a single interval and will not return multiple interv
# Examples
```jldoctest; setup = :(using Random; Random.seed!(582))
julia> val = rand(500, 2, 3);
```jldoctest
julia> using StableRNGs; rng = StableRNG(42);
julia> val = rand(rng, 500, 2, 3);
julia> chn = Chains(val, [:a, :b]);
julia> hdi(chn)
HDI
lower upper
a 0.0749 0.999
b 0.00531 0.940
lower upper
a 0.0630 0.994
b 0.0404 0.968
```
"""
function PosteriorStats.hdi(chn::Chains; prob::Real=0.94, kwargs...)
Expand Down

0 comments on commit 1e3e96a

Please sign in to comment.