Skip to content

Commit

Permalink
Convert ArviZ.jl into a meta-package (#297)
Browse files Browse the repository at this point in the history
* Remove unneeded `@doc`

* Remove all unneeded dependencies

* Remove ArviZStats

* Remove R installation from CI

* Add PosteriorStats and Reexport as deps

* Reexport component packages

* Fix broken links

* Update stats API docs

* Add back PSIS compat bound

* Remove unused test dependencies

* Remove test Project.toml

* Add missing SampleChainsDynamicHMC compat

* Remove docs compat entry

* Add component packages as docs deps

This is needed so that extensions can load the package with `using SomePackage`

* Correctly set up to build docstrings in extensions

* Build docs strictly

* Document meta-ness of package

* Build docs nightly

* Increment minor version number

* Add StatsBase for doctests

* Disable caching

* Try building docs directly

* Copy from InferenceObjects's docs build [no ci]

* Revert "Copy from InferenceObjects's docs build [no ci]"

This reverts commit cafadf8.

* Revert "Revert "Copy from InferenceObjects's docs build""

This reverts commit 0cdfd99.

* Revert "Disable caching"

This reverts commit 6ccbadf.
  • Loading branch information
sethaxen authored Aug 8, 2023
1 parent c31176a commit 5d5a2d2
Show file tree
Hide file tree
Showing 35 changed files with 98 additions and 4,159 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ jobs:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
run: |
using CompatHelper
subdirs = ["", "test", "docs"]
CompatHelper.main(; subdirs)
shell: julia --color=yes {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_KEY }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
run: julia --color=yes -e 'using CompatHelper; CompatHelper.main()'
13 changes: 0 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,6 @@ jobs:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
if: matrix.os == 'ubuntu-latest'
- name: Set R lib path for RCall.jl
if: matrix.os == 'ubuntu-latest'
run: echo "LD_LIBRARY_PATH=$(R RHOME)/lib" >> $GITHUB_ENV
- name: Install R packages
if: matrix.os == 'ubuntu-latest'
run: |
install.packages("remotes")
remotes::install_github("stan-dev/loo")
shell: Rscript {0}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
branches: [main]
tags: [v*]
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
docs:
Expand All @@ -13,8 +15,12 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-buildpkg@v1
- name: Install dependencies
run: julia --color=yes --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- uses: julia-actions/julia-docdeploy@v1
with:
install-package: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
49 changes: 15 additions & 34 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
name = "ArviZ"
uuid = "131c737c-5715-5e2e-ad31-c244f01c1dc7"
authors = ["Seth Axen <[email protected]>"]
version = "0.9.2"
version = "0.10.0"

[deps]
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
InferenceObjects = "b5cf5a8d-e756-4ee3-b014-01d49d192c00"
IteratorInterfaceExtensions = "82899510-4779-5014-852e-03e436cf321d"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
MCMCDiagnosticTools = "be115224-59cd-429b-ad48-344e309966f0"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
PSIS = "ce719bf2-d5d0-4fb9-925d-10a81b42ad04"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
PosteriorStats = "7f36be82-ad55-44ba-a5c0-b8b5480d7aa5"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TableTraits = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[weakdeps]
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
Expand All @@ -36,32 +19,30 @@ SampleChainsDynamicHMC = "6d9fd711-e8b2-4778-9c70-c1dfb499d4c4"

[extensions]
ArviZMCMCChainsExt = "MCMCChains"
ArviZSampleChainsExt = "SampleChains"
ArviZSampleChainsDynamicHMCExt = ["SampleChains", "SampleChainsDynamicHMC"]
ArviZSampleChainsExt = "SampleChains"

[compat]
DataInterpolations = "4"
DimensionalData = "0.23, 0.24"
Distributions = "0.21, 0.22, 0.23, 0.24, 0.25"
DocStringExtensions = "0.8, 0.9"
InferenceObjects = "0.3.10"
IteratorInterfaceExtensions = "0.1.1, 1"
LogExpFunctions = "0.2.0, 0.3"
InferenceObjects = "0.3.11"
MCMCChains = "6"
MCMCDiagnosticTools = "0.3.4"
Optim = "1"
OrderedCollections = "1"
PosteriorStats = "0.1.1"
PSIS = "0.9.1"
PrettyTables = "2.1, 2.2"
Reexport = "1"
Requires = "0.5.2, 1.0"
SampleChains = "0.5"
Setfield = "1"
SampleChainsDynamicHMC = "0.3"
StatsBase = "0.32, 0.33, 0.34"
TableTraits = "0.4, 1"
Tables = "1"
julia = "1.6"

[extras]
DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SampleChains = "754583d1-7fc4-4dab-93b5-5eaca5c9622e"
SampleChainsDynamicHMC = "6d9fd711-e8b2-4778-9c70-c1dfb499d4c4"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["DimensionalData", "MCMCChains", "OrderedCollections", "Random", "SampleChains", "SampleChainsDynamicHMC", "Test"]
23 changes: 4 additions & 19 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,16 @@ Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
EvoTrees = "f6006082-12f8-11e9-0c9c-0d5d367ab1e5"
InferenceObjects = "b5cf5a8d-e756-4ee3-b014-01d49d192c00"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
MCMCDiagnosticTools = "be115224-59cd-429b-ad48-344e309966f0"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
MLJIteration = "614be32b-d00c-4edb-bd02-1eb411ab5e55"
PSIS = "ce719bf2-d5d0-4fb9-925d-10a81b42ad04"
PlutoStaticHTML = "359b1769-a58e-495b-9770-312e911026ad"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
PosteriorStats = "7f36be82-ad55-44ba-a5c0-b8b5480d7aa5"
SampleChains = "754583d1-7fc4-4dab-93b5-5eaca5c9622e"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
AlgebraOfGraphics = "0.6.9"
ArviZ = "0.9"
ArviZExampleData = "0.1.5"
CairoMakie = "0.8.9, 0.9, 0.10"
DataFrames = "1"
DimensionalData = "0.23, 0.24"
Distributions = "0.25"
EvoTrees = "0.14.8, 0.15"
Documenter = "0.27"
MCMCChains = "6.0"
MCMCDiagnosticTools = "0.3"
MLJBase = "0.21.6"
MLJIteration = "0.5.1"
PlutoStaticHTML = "4.0.5, 5, 6"
PlutoUI = "0.7"
SampleChains = "0.5"
Statistics = "1"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
45 changes: 33 additions & 12 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,50 @@ function download_asset(remote_fn, fn=remote_fn)
)
end

function get_extension(mod::Module, submodule::Symbol)
if isdefined(Base, :get_extension)
return Base.get_extension(mod, submodule)
else
return getproperty(mod, submodule)
end
end

# download arviz-devs org logo assets
download_asset("ArviZ.png", "logo.png")
download_asset("ArviZ_white.png", "logo-dark.png")
download_asset("favicon.ico")

InferenceObjectsMCMCDiagnosticToolsExt = get_extension(
InferenceObjects, :InferenceObjectsMCMCDiagnosticToolsExt
)
InferenceObjectsPosteriorStatsExt = get_extension(
InferenceObjects, :InferenceObjectsPosteriorStatsExt
)

for subpkg in (InferenceObjects, MCMCDiagnosticTools, PosteriorStats, PSIS)
DocMeta.setdocmeta!(subpkg, :DocTestSetup, :(using $(Symbol(subpkg))))
end
DocMeta.setdocmeta!(
ArviZ.MCMCDiagnosticTools, :DocTestSetup, :(using ArviZ.MCMCDiagnosticTools);
InferenceObjectsMCMCDiagnosticToolsExt, :DocTestSetup, :(using MCMCDiagnosticTools)
)
DocMeta.setdocmeta!(ArviZ.InferenceObjects, :DocTestSetup, :(using ArviZ.InferenceObjects);)
DocMeta.setdocmeta!(
InferenceObjectsPosteriorStatsExt, :DocTestSetup, :(using PosteriorStats)
)

modules = [
ArviZ,
InferenceObjects,
InferenceObjectsMCMCDiagnosticToolsExt,
InferenceObjectsPosteriorStatsExt,
MCMCDiagnosticTools,
PosteriorStats,
PSIS,
]

doctestfilters = [
r"\s+\"created_at\" => .*", # ignore timestamps in doctests
]

modules = [ArviZ, InferenceObjects, MCMCDiagnosticTools, PSIS]
if isdefined(Base, :get_extension)
# using Requires, these docstrings are automatically loaded, but as an extension we need
# to manually specify the module
push!(
modules,
Base.get_extension(InferenceObjects, :InferenceObjectsMCMCDiagnosticToolsExt),
)
end

makedocs(;
modules,
sitename="ArviZ.jl",
Expand Down Expand Up @@ -79,6 +99,7 @@ makedocs(;
doctestfilters,
linkcheck=true,
analytics="G-W1G68W77YV",
strict=Documenter.except(:footnote, :missing_docs),
)

deploydocs(; repo="github.com/arviz-devs/ArviZ.jl.git", devbranch="main", push_preview=true)
16 changes: 11 additions & 5 deletions docs/src/api/stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Pages = ["stats.md"]

```@docs
SummaryStats
default_summary_stats
default_stats
default_diagnostics
summarize
summarystats
```

Expand All @@ -22,9 +26,11 @@ r2_score
## Pareto-smoothed importance sampling

```@docs
PSIS.PSISResult
PSIS.psis
PSIS.psis!
PSISResult
ess_is
PSISPlots.paretoshapeplot
psis
psis!
```

## LOO and WAIC
Expand Down Expand Up @@ -61,8 +67,8 @@ Stacking
loo_pit
```

### Utilities
## Utilities

```@docs
ArviZStats.smooth_data
PosteriorStats.smooth_data
```
16 changes: 14 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# [ArviZ.jl: Exploratory analysis of Bayesian models in Julia](@id arvizjl)

ArviZ.jl is a Julia package for exploratory analysis of Bayesian models.
ArviZ.jl is a Julia meta-package for exploratory analysis of Bayesian models.
It is part of the [ArviZ project](https://www.arviz.org/), which also includes a related [Python package](https://python.arviz.org/).

ArviZ consists of and re-exports the following subpackages, along with extensions integrating them with InferenceObjects:
- [InferenceObjects.jl](https://julia.arviz.org/InferenceObjects): a base package implementing the [`InferenceData`](@ref) type with utilities for building, saving, and working with it
- [MCMCDiagnosticTools.jl](https://julia.arviz.org/MCMCDiagnosticTools): diagnostics for Markov Chain Monte Carlo methods
- [PSIS.jl](https://julia.arviz.org/PSIS): Pareto-smoothed importance sampling
- [PosteriorStats.jl](https://julia.arviz.org/PosteriorStats): common statistical analyses for the Bayesian workflow

Additional functionality can be loaded with the following packages:
- [ArviZExampleData.jl](https://julia.arviz.org/ArviZExampleData): example `InferenceData` objects, useful for demonstration and testing
- [ArviZPythonPlots.jl](https://julia.arviz.org/ArviZPythonPlots): Python ArviZ's library of plotting functions for Julia types

See the navigation bar for more useful packages.

## [Installation](@id installation)

From the Julia REPL, type `]` to enter the Pkg REPL mode and run
Expand All @@ -17,4 +29,4 @@ See the [API Overview](@ref api) for description of functions.

## [Extending ArviZ.jl](@id extendingarviz)

To use a custom data type with ArviZ.jl, simply overload [`convert_to_inference_data`](@ref) to convert your input(s) to an [`InferenceData`](@ref).
To use a custom data type with ArviZ.jl, simply overload [`InferenceObjects.convert_to_inference_data`](@ref) to convert your input(s) to an [`InferenceObjects.InferenceData`](@ref).
6 changes: 3 additions & 3 deletions docs/src/working_with_inference_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ idata = load_example_data("centered_eight")
```

!!! info
`Dataset`s are [`DimensionalData.AbstractDimStack`](https://rafaqz.github.io/DimensionalData.jl/stable/api/#DimensionalData.AbstractDimStack)s and can be used identically.
`Dataset`s are [`DimensionalData.AbstractDimStack`](https://rafaqz.github.io/DimensionalData.jl/stable/reference/#DimensionalData.AbstractDimStack)s and can be used identically.
The variables a `Dataset` contains are called "layers", and dimensions of the same name that appear in more than one layer within a `Dataset` must have the same indices.

`InferenceData` behaves like a `NamedTuple` and can be used similarly.
Expand Down Expand Up @@ -121,7 +121,7 @@ Let’s keep only chain 0 here.
For the subset to take effect on all relevant `InferenceData` groups -- `posterior`, `sample_stats`, `log_likelihood`, and `posterior_predictive` -- we will index `InferenceData` instead of `Dataset`.

Here we use DimensionalData's `At` selector.
Its [other selectors](https://rafaqz.github.io/DimensionalData.jl/stable/api/#Selectors) are also supported.
Its [other selectors](https://rafaqz.github.io/DimensionalData.jl/stable/reference/#selectors) are also supported.

```@example wwid
idata[chain=At(0)]
Expand Down Expand Up @@ -179,7 +179,7 @@ dropdims(mean(post; dims=(:chain, :draw)); dims=(:chain, :draw))

## Renaming a dimension

We can rename a dimension in a `Dataset` using DimensionalData's [`set`](https://rafaqz.github.io/DimensionalData.jl/stable/api/#DimensionalData.Dimensions.LookupArrays.set) method:
We can rename a dimension in a `Dataset` using DimensionalData's [`set`](https://rafaqz.github.io/DimensionalData.jl/stable/reference/#DimensionalData.Dimensions.LookupArrays.set) method:

```@example wwid
theta_bis = set(post.theta; school=:school_bis)
Expand Down
Loading

2 comments on commit 5d5a2d2

@sethaxen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/89291

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.0 -m "<description of version>" 5d5a2d282d3c52c4b4d9fc01742aa92a595b7bb6
git push origin v0.10.0

Please sign in to comment.