Skip to content

Commit d7eb0d8

Browse files
github-actions[bot]CompatHelper Juliasethaxen
authored
CompatHelper: bump compat for PosteriorStats in [weakdeps] to 0.4, (keep existing compat) (#102)
* CompatHelper: bump compat for PosteriorStats in [weakdeps] to 0.4, (keep existing compat) * Remove imports and exports Not used in extensions * Only overload and test waic if defined * Increment patch version * Update r2_score docstring * Update summarize doctest --------- Co-authored-by: CompatHelper Julia <[email protected]> Co-authored-by: Seth Axen <[email protected]>
1 parent 8b46258 commit d7eb0d8

File tree

6 files changed

+26
-29
lines changed

6 files changed

+26
-29
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 <[email protected]> and contributors"]
4-
version = "0.4.13"
4+
version = "0.4.14"
55

66
[deps]
77
ANSIColoredPrinters = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
@@ -32,7 +32,7 @@ MLJBase = "1"
3232
NCDatasets = "0.12.6, 0.13, 0.14"
3333
OffsetArrays = "1"
3434
OrderedCollections = "1.6"
35-
PosteriorStats = "0.3"
35+
PosteriorStats = "0.3, 0.4"
3636
Random = "1"
3737
StatsBase = "0.33.7, 0.34"
3838
Tables = "1.11.0"

ext/InferenceObjectsPosteriorStatsExt/InferenceObjectsPosteriorStatsExt.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ using InferenceObjects: InferenceObjects
66
using PosteriorStats: PosteriorStats
77
using StatsBase: StatsBase
88

9-
import PosteriorStats: eti, hdi, loo, loo_pit, r2_score, summarize, waic
109
import StatsBase: summarystats
1110

12-
export eti, hdi, loo, loo_pit, r2_score, summarize, waic, summarystats
13-
1411
maplayers = isdefined(DimensionalData, :maplayers) ? DimensionalData.maplayers : map
1512

1613
include("utils.jl")
1714
include("ci.jl")
1815
include("loo.jl")
19-
include("waic.jl")
16+
@static if isdefined(PosteriorStats, :waic)
17+
include("waic.jl")
18+
end
2019
include("loo_pit.jl")
2120
include("r2_score.jl")
2221
include("summarize.jl")

ext/InferenceObjectsPosteriorStatsExt/ci.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11

22
for (ci_fun, ci_desc) in
33
(:eti => "equal-tailed interval (ETI)", :hdi => "highest density interval (HDI)")
4+
ci_name = string(ci_fun)
45
@eval begin
5-
# this pattern ensures that the type is completely specified at compile time
66
@doc """
7-
$($ci_fun)(data::InferenceData; kwargs...) -> Dataset
8-
$($ci_fun)(data::Dataset; kwargs...) -> Dataset
7+
$($ci_name)(data::InferenceData; kwargs...) -> Dataset
8+
$($ci_name)(data::Dataset; kwargs...) -> Dataset
99
1010
Calculate the $($ci_desc) for each parameter in the data.
1111
1212
For more details and a description of the `kwargs`, see
13-
[`PosteriorStats.$($ci_fun)`](@extref).
13+
[`PosteriorStats.$($ci_name)`](@extref).
1414
"""
1515
function PosteriorStats.$(ci_fun)(data::InferenceObjects.InferenceData; kwargs...)
1616
return PosteriorStats.$(ci_fun)(data.posterior; kwargs...)

ext/InferenceObjectsPosteriorStatsExt/r2_score.jl

Lines changed: 5 additions & 7 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) -> (; r2, r2_std)
2+
r2_score(idata::InferenceData; y_name, y_pred_name, kwargs...) -> (; r2, <ci>)
33
44
Compute ``R²`` from `idata`, automatically formatting the predictions to the correct shape.
55
@@ -9,8 +9,8 @@ Compute ``R²`` from `idata`, automatically formatting the predictions to the co
99
the only observed data variable is used.
1010
- `y_pred_name`: Name of posterior predictive variable in `idata.posterior_predictive`.
1111
If not provided, then `y_name` is used.
12-
13-
See [`PosteriorStats.r2_score`](@extref) for more details.
12+
- `kwargs...`: Additional keyword arguments to pass to
13+
[`PosteriorStats.r2_score`](@extref).
1414
1515
# Examples
1616
@@ -19,10 +19,8 @@ julia> using ArviZExampleData, PosteriorStats
1919
2020
julia> idata = load_example_data("regression10d");
2121
22-
julia> r2_score(idata) |> pairs
23-
pairs(::NamedTuple) with 2 entries:
24-
:r2 => 0.998385
25-
:r2_std => 0.000100621
22+
julia> r2_score(idata)
23+
(r2 = 0.998384805658226, eti = 0.9982167674001565 .. 0.9985401916739318)
2624
```
2725
"""
2826
function PosteriorStats.r2_score(

ext/InferenceObjectsPosteriorStatsExt/summarize.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ julia> data = load_example_data("centered_eight");
3333
3434
julia> summarize(data)
3535
SummaryStats
36-
mean std eti94 ess_tail ess_bulk rhat mcse_mean mcse_std
37-
mu 4.2 3.3 -2.11 .. 9.90 622 241 1.03 0.21 0.088
38-
theta[Choate] 6.4 5.9 -3.05 .. 19.1 937 572 1.01 0.25 0.20
39-
theta[Deerfield] 5.0 4.9 -4.49 .. 14.2 1214 532 1.01 0.21 0.15
40-
theta[Phillips Andover] 3.4 5.4 -8.17 .. 12.7 1017 511 1.01 0.23 0.17
41-
theta[Phillips Exeter] 4.8 5.2 -4.84 .. 14.5 911 572 1.01 0.21 0.21
42-
theta[Hotchkiss] 3.5 4.8 -6.11 .. 12.0 789 347 1.02 0.25 0.15
43-
theta[Lawrenceville] 3.7 5.2 -6.62 .. 12.6 957 506 1.01 0.22 0.21
44-
theta[St. Paul's] 6.5 5.2 -2.38 .. 18.3 1031 528 1.01 0.22 0.15
45-
theta[Mt. Hermon] 4.8 5.7 -5.52 .. 16.0 1045 538 1.01 0.24 0.23
46-
tau 4.3 3.0 1.06 .. 11.5 214 128 1.03 0.22 0.14
36+
mean std eti89 ess_tail ess_bulk rhat mcse_mean mcse_std
37+
mu 4.2 3.3 -1.15 .. 9.15 622 241 1.03 0.21 0.088
38+
theta[Choate] 6.4 5.9 -1.72 .. 16.6 937 572 1.01 0.25 0.20
39+
theta[Deerfield] 5.0 4.9 -3.03 .. 12.4 1214 532 1.01 0.21 0.15
40+
theta[Phillips Andover] 3.4 5.4 -5.69 .. 11.3 1017 511 1.01 0.23 0.17
41+
theta[Phillips Exeter] 4.8 5.2 -3.08 .. 12.7 911 572 1.01 0.21 0.21
42+
theta[Hotchkiss] 3.5 4.8 -4.29 .. 10.6 789 347 1.02 0.25 0.15
43+
theta[Lawrenceville] 3.7 5.2 -4.41 .. 11.4 957 506 1.01 0.22 0.21
44+
theta[St. Paul's] 6.5 5.2 -1.05 .. 15.8 1031 528 1.01 0.22 0.15
45+
theta[Mt. Hermon] 4.8 5.7 -3.78 .. 13.9 1045 538 1.01 0.24 0.23
46+
tau 4.3 3.0 1.27 .. 9.95 214 128 1.03 0.22 0.14
4747
```
4848
4949
Compute the mean, standard deviation, median, and median absolute deviation of the `theta`

test/posteriorstats.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ _as_array(x::AbstractArray) = x
172172
end
173173
end
174174

175-
@testset "waic" begin
175+
isdefined(PosteriorStats, :waic) && @testset "waic" begin
176176
@testset for sz in ((1000, 4), (1000, 4, 2), (100, 4, 2, 3))
177177
atol_perm = cbrt(eps())
178178

0 commit comments

Comments
 (0)