Skip to content

Commit

Permalink
Fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
sethaxen committed Jul 26, 2023
1 parent 2805d8b commit 2e87724
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/ArviZStats/hdi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ This implementation uses the algorithm of [^ChenShao1999].
Here we calculate the 83% HDI for a normal random variable:
```jldoctest; setup = :(using Random; Random.seed!(78))
```jldoctest hdi; setup = :(using Random; Random.seed!(78))

Check failure on line 40 in src/ArviZStats/hdi.jl

View workflow job for this annotation

GitHub Actions / Documentation

doctest failure in ~/work/ArviZ.jl/ArviZ.jl/src/ArviZStats/hdi.jl:40-48 ```jldoctest hdi; setup = :(using Random; Random.seed!(78)) using ArviZ x = randn(2_000) hdi(x; prob=0.83) # output (lower = -1.3826605224220527, upper = 1.259817149822839) ``` Subexpression: using ArviZ x = randn(2_000) hdi(x; prob=0.83) Evaluated output: (lower = -1.3826605224220527, upper = 1.259817149822839,) Expected output: (lower = -1.3826605224220527, upper = 1.259817149822839) diff = Warning: Diff output requires color. (lower = -1.3826605224220527, -1.3826605224220527, upper = 1.259817149822839)1.259817149822839,)
using ArviZ
x = randn(2_000)
hdi(x; prob=0.83)
Expand All @@ -48,7 +49,7 @@ hdi(x; prob=0.83)
We can also calculate the HDI for a 3-dimensional array of samples:
```jldoctest; setup = :(using Random; Random.seed!(67))
```jldoctest hdi; setup = :(using Random; Random.seed!(67))
x = randn(1_000, 1, 1) .+ reshape(0:5:10, 1, 1, :)
pairs(hdi(x))
Expand Down Expand Up @@ -121,8 +122,8 @@ hdi(idata)
# output
Dataset with dimensions:
Dim{:hdi_bound} Categorical{Symbol} Symbol[:lower, :upper] ForwardOrdered,
Dim{:school} Categorical{String} String[Choate, Deerfield, …, St. Paul's, Mt. Hermon] Unordered
Dim{:school} Categorical{String} String[Choate, Deerfield, …, St. Paul's, Mt. Hermon] Unordered,
Dim{:hdi_bound} Categorical{Symbol} Symbol[:lower, :upper] ForwardOrdered
and 3 layers:
:mu Float64 dims: Dim{:hdi_bound} (2)
:theta Float64 dims: Dim{:school}, Dim{:hdi_bound} (8×2)
Expand Down
2 changes: 1 addition & 1 deletion src/ArviZStats/r2_score.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Compute ``R²`` from `idata`, automatically formatting the predictions to the co
```jldoctest

Check failure on line 48 in src/ArviZStats/r2_score.jl

View workflow job for this annotation

GitHub Actions / Documentation

doctest failure in ~/work/ArviZ.jl/ArviZ.jl/src/ArviZStats/r2_score.jl:48-56 ```jldoctest using ArviZ, ArviZExampleData idata = load_example_data("regression10d") r2_score(idata) # output (r2 = 0.998384805658226, r2_std = 0.00010062063385452256) ``` Subexpression: using ArviZ, ArviZExampleData idata = load_example_data("regression10d") r2_score(idata) Evaluated output: (r2 = 0.998384805658226, r2_std = 0.00010062063385452256,) Expected output: (r2 = 0.998384805658226, r2_std = 0.00010062063385452256) diff = Warning: Diff output requires color. (r2 = 0.998384805658226, 0.998384805658226, r2_std = 0.00010062063385452256)0.00010062063385452256,)
using ArviZ, ArviZExampleData
idata = load_arviz_data("regression10d")
idata = load_example_data("regression10d")
r2_score(idata)
# output
Expand Down

0 comments on commit 2e87724

Please sign in to comment.