Skip to content

Commit e87d253

Browse files
github-actions[bot]CompatHelper Juliasethaxen
authored
chore: Bump compat for ArviZExampleData in [extras] to 0.3 (#108)
* CompatHelper: bump compat for ArviZExampleData in [extras] to 0.3, (keep existing compat) * test: Update r2_score test to use anes dataset * docs: Update r2_score doscstring to use anes dataset * docs: Make r2_score documented return value consistent with PosteriorStats * Increment patch number * test: Require ArviZExampleData v0.3 * docs: Set ArviZExampleData compat * test: Fix y variable name in test * style: Keep Project.toml format --------- Co-authored-by: CompatHelper Julia <compathelper_noreply@julialang.org> Co-authored-by: Seth Axen <seth@sethaxen.com>
1 parent d7eb0d8 commit e87d253

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "InferenceObjects"
22
uuid = "b5cf5a8d-e756-4ee3-b014-01d49d192c00"
33
authors = ["Seth Axen <seth.axen@gmail.com> and contributors"]
4-
version = "0.4.14"
4+
version = "0.4.15"
55

66
[deps]
77
ANSIColoredPrinters = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
@@ -23,7 +23,7 @@ InferenceObjectsPosteriorStatsExt = ["PosteriorStats", "StatsBase"]
2323

2424
[compat]
2525
ANSIColoredPrinters = "0.0.1"
26-
ArviZExampleData = "0.1.10"
26+
ArviZExampleData = "0.3"
2727
Dates = "1"
2828
DimensionalData = "0.27, 0.28, 0.29"
2929
EvoTrees = "0.16"

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
1212
InferenceObjects = {path = ".."}
1313

1414
[compat]
15+
ArviZExampleData = "0.3"
1516
Documenter = "1"
1617
DocumenterInterLinks = "1"

ext/InferenceObjectsPosteriorStatsExt/r2_score.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@doc """
2-
r2_score(idata::InferenceData; y_name, y_pred_name, kwargs...) -> (; r2, <ci>)
2+
r2_score(idata::InferenceData; y_name, y_pred_name, kwargs...) -> (; r2, <ci_fun>)
33
44
Compute ``R²`` from `idata`, automatically formatting the predictions to the correct shape.
55
@@ -17,10 +17,10 @@ Compute ``R²`` from `idata`, automatically formatting the predictions to the co
1717
```jldoctest
1818
julia> using ArviZExampleData, PosteriorStats
1919
20-
julia> idata = load_example_data("regression10d");
20+
julia> idata = load_example_data("anes");
2121
2222
julia> r2_score(idata)
23-
(r2 = 0.998384805658226, eti = 0.9982167674001565 .. 0.9985401916739318)
23+
(r2 = 0.4944850210319484, eti = 0.46184359652436546 .. 0.528018251711097)
2424
```
2525
"""
2626
function PosteriorStats.r2_score(

test/posteriorstats.jl

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,17 @@ _as_array(x::AbstractArray) = x
157157
end
158158

159159
@testset "r2_score" begin
160-
@testset for name in ("regression1d", "regression10d")
161-
idata = load_example_data(name)
162-
r2_val = @inferred(r2_score(idata))
163-
@test r2_val == r2_score(
164-
idata.observed_data.y,
165-
PermutedDimsArray(idata.posterior_predictive.y, (:draw, :chain, :y_dim_0)),
166-
)
167-
@test r2_val == r2_score(idata; y_name=:y)
168-
@test r2_val == r2_score(idata; y_pred_name=:y)
169-
@test r2_val == r2_score(idata; y_name=:y, y_pred_name=:y)
170-
@test_throws Exception r2_score(idata; y_name=:z)
171-
@test_throws Exception r2_score(idata; y_pred_name=:z)
172-
end
160+
idata = load_example_data("anes")
161+
r2_val = @inferred(r2_score(idata))
162+
@test r2_val == r2_score(
163+
idata.observed_data.vote,
164+
PermutedDimsArray(idata.posterior_predictive.vote, (:draw, :chain, :__obs__)),
165+
)
166+
@test r2_val == r2_score(idata; y_name=:vote)
167+
@test r2_val == r2_score(idata; y_pred_name=:vote)
168+
@test r2_val == r2_score(idata; y_name=:vote, y_pred_name=:vote)
169+
@test_throws Exception r2_score(idata; y_name=:z)
170+
@test_throws Exception r2_score(idata; y_pred_name=:z)
173171
end
174172

175173
isdefined(PosteriorStats, :waic) && @testset "waic" begin
@@ -199,7 +197,8 @@ _as_array(x::AbstractArray) = x
199197
)
200198
idata2 = InferenceData(; log_likelihood=Dataset((; y=ll_perm)))
201199
waic_result2 = waic(idata2)
202-
@test waic_result2.estimates.elpd waic_result1.estimates.elpd atol = atol_perm
200+
@test waic_result2.estimates.elpd waic_result1.estimates.elpd atol =
201+
atol_perm
203202
@test isapprox(
204203
waic_result2.estimates.se_elpd,
205204
waic_result1.estimates.se_elpd;

0 commit comments

Comments
 (0)