-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
Dec 17, 2023
0 parents
commit 29b241b
Showing
1,998 changed files
with
1,733,645 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Data · ArviZ.jl</title><script data-outdated-warner src="../../assets/warner.js"></script><link rel="canonical" href="stable/api/data/"/><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.045/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.24/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/><link href="../../assets/custom.css" rel="stylesheet" type="text/css"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img class="docs-light-only" src="../../assets/logo.png" alt="ArviZ.jl logo"/><img class="docs-dark-only" src="../../assets/logo-dark.png" alt="ArviZ.jl logo"/></a><form class="docs-search" action="../../search/"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../../">Home</a></li><li><span class="tocitem">Getting Started</span><ul><li><a class="tocitem" href="../../quickstart/">Quickstart</a></li><li><a class="tocitem" href="../../working_with_inference_data/">Working with <code>InferenceData</code></a></li><li><a class="tocitem" href="../../creating_custom_plots/">Creating custom plots</a></li></ul></li><li><span class="tocitem">API</span><ul><li><a class="tocitem" href="../stats/">Stats</a></li><li><a class="tocitem" href="../diagnostics/">Diagnostics</a></li><li class="is-active"><a class="tocitem" href>Data</a><ul class="internal"><li><a class="tocitem" href="#Inference-library-converters"><span>Inference library converters</span></a></li><li><a class="tocitem" href="#IO-/-Conversion"><span>IO / Conversion</span></a></li></ul></li><li><input class="collapse-toggle" id="menuitem-3-5" type="checkbox"/><label class="tocitem" for="menuitem-3-5"><span class="docs-label">InferenceObjects</span><i class="docs-chevron"></i></label><ul class="collapsed"><li><a class="tocitem" href="../inference_data/">InferenceData</a></li><li><a class="tocitem" href="../dataset/">Dataset</a></li></ul></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">API</a></li><li class="is-active"><a href>Data</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Data</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/arviz-devs/ArviZ.jl/blob/main/docs/src/api/data.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="data-api"><a class="docs-heading-anchor" href="#data-api">Data</a><a id="data-api-1"></a><a class="docs-heading-anchor-permalink" href="#data-api" title="Permalink"></a></h1><ul><li><a href="#ArviZ.from_mcmcchains"><code>ArviZ.from_mcmcchains</code></a></li><li><a href="#ArviZ.from_samplechains"><code>ArviZ.from_samplechains</code></a></li><li><a href="#InferenceObjects.from_netcdf"><code>InferenceObjects.from_netcdf</code></a></li><li><a href="#InferenceObjects.to_netcdf"><code>InferenceObjects.to_netcdf</code></a></li></ul><h2 id="Inference-library-converters"><a class="docs-heading-anchor" href="#Inference-library-converters">Inference library converters</a><a id="Inference-library-converters-1"></a><a class="docs-heading-anchor-permalink" href="#Inference-library-converters" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-binding" id="ArviZ.from_mcmcchains" href="#ArviZ.from_mcmcchains"><code>ArviZ.from_mcmcchains</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">from_mcmcchains(posterior::MCMCChains.Chains; kwargs...) -> InferenceData | ||
from_mcmcchains(; kwargs...) -> InferenceData | ||
from_mcmcchains( | ||
posterior::MCMCChains.Chains, | ||
posterior_predictive, | ||
predictions, | ||
log_likelihood; | ||
kwargs... | ||
) -> InferenceData</code></pre><p>Convert data in an <code>MCMCChains.Chains</code> format into an <a href="../inference_data/#InferenceObjects.InferenceData"><code>InferenceData</code></a>.</p><p>Any keyword argument below without an an explicitly annotated type above is allowed, so long as it can be passed to <a href="../inference_data/#InferenceObjects.convert_to_inference_data"><code>convert_to_inference_data</code></a>.</p><p><strong>Arguments</strong></p><ul><li><code>posterior::MCMCChains.Chains</code>: Draws from the posterior</li></ul><p><strong>Keywords</strong></p><ul><li><code>posterior_predictive::Any=nothing</code>: Draws from the posterior predictive distribution or name(s) of predictive variables in <code>posterior</code></li><li><code>predictions</code>: Out-of-sample predictions for the posterior.</li><li><code>prior</code>: Draws from the prior</li><li><code>prior_predictive</code>: Draws from the prior predictive distribution or name(s) of predictive variables in <code>prior</code></li><li><code>observed_data</code>: Observed data on which the <code>posterior</code> is conditional. It should only contain data which is modeled as a random variable. Keys are parameter names and values.</li><li><code>constant_data</code>: Model constants, data included in the model that are not modeled as random variables. Keys are parameter names.</li><li><code>predictions_constant_data</code>: Constants relevant to the model predictions (i.e. new <code>x</code> values in a linear regression).</li><li><code>log_likelihood</code>: Pointwise log-likelihood for the data. It is recommended to use this argument as a named tuple whose keys are observed variable names and whose values are log likelihood arrays. Alternatively, provide the name of variable in <code>posterior</code> containing log likelihoods.</li><li><code>library=MCMCChains</code>: Name of library that generated the chains</li><li><code>coords</code>: Map from named dimension to named indices</li><li><code>dims</code>: Map from variable name to names of its dimensions</li><li><code>eltypes</code>: Map from variable names to eltypes. This is primarily used to assign discrete eltypes to discrete variables that were stored in <code>Chains</code> as floats.</li></ul><p><strong>Returns</strong></p><ul><li><code>InferenceData</code>: The data with groups corresponding to the provided data</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/arviz-devs/ArviZ.jl/blob/0ab2c5a7bf0558442679bf9dd5f799fc3d9229d2/src/conversions.jl#L1-L48">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="ArviZ.from_samplechains" href="#ArviZ.from_samplechains"><code>ArviZ.from_samplechains</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">from_samplechains( | ||
posterior=nothing; | ||
prior=nothing, | ||
library=SampleChains, | ||
kwargs..., | ||
) -> InferenceData</code></pre><p>Convert SampleChains samples to an <code>InferenceData</code>.</p><p>Either <code>posterior</code> or <code>prior</code> may be a <code>SampleChains.AbstractChain</code> or <code>SampleChains.MultiChain</code> object.</p><p>For descriptions of remaining <code>kwargs</code>, see <a href="../inference_data/#InferenceObjects.from_namedtuple"><code>from_namedtuple</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/arviz-devs/ArviZ.jl/blob/0ab2c5a7bf0558442679bf9dd5f799fc3d9229d2/src/conversions.jl#L51-L65">source</a></section></article><h2 id="IO-/-Conversion"><a class="docs-heading-anchor" href="#IO-/-Conversion">IO / Conversion</a><a id="IO-/-Conversion-1"></a><a class="docs-heading-anchor-permalink" href="#IO-/-Conversion" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-binding" id="InferenceObjects.from_netcdf" href="#InferenceObjects.from_netcdf"><code>InferenceObjects.from_netcdf</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">from_netcdf(path::AbstractString; kwargs...) -> InferenceData</code></pre><p>Load an <a href="../inference_data/#InferenceObjects.InferenceData"><code>InferenceData</code></a> from an unopened NetCDF file.</p><p>Remaining <code>kwargs</code> are passed to <a href="https://alexander-barth.github.io/NCDatasets.jl/stable/dataset/#NCDatasets.NCDataset"><code>NCDatasets.NCDataset</code></a>. This method loads data eagerly. To instead load data lazily, pass an opened <code>NCDataset</code> to <code>from_netcdf</code>.</p><div class="admonition is-info"><header class="admonition-header">Note</header><div class="admonition-body"><p>This method requires that NCDatasets is loaded before it can be used.</p></div></div><p><strong>Examples</strong></p><pre><code class="language-julia hljs">julia> using InferenceObjects, NCDatasets | ||
|
||
julia> idata = from_netcdf("centered_eight.nc") | ||
InferenceData with groups: | ||
> posterior | ||
> posterior_predictive | ||
> sample_stats | ||
> prior | ||
> observed_data</code></pre><pre><code class="nohighlight hljs">from_netcdf(ds::NCDatasets.NCDataset; load_mode) -> InferenceData</code></pre><p>Load an <a href="../inference_data/#InferenceObjects.InferenceData"><code>InferenceData</code></a> from an opened NetCDF file.</p><p><code>load_mode</code> defaults to <code>:lazy</code>, which avoids reading variables into memory. Operations on these arrays will be slow. <code>load_mode</code> can also be <code>:eager</code>, which copies all variables into memory. It is then safe to close <code>ds</code>. If <code>load_mode</code> is <code>:lazy</code> and <code>ds</code> is closed after constructing <code>InferenceData</code>, using the variable arrays will have undefined behavior.</p><p><strong>Examples</strong></p><p>Here is how we might load an <code>InferenceData</code> from an <code>InferenceData</code> lazily from a web-hosted NetCDF file.</p><pre><code class="language-julia hljs">julia> using HTTP, InferenceObjects, NCDatasets | ||
|
||
julia> resp = HTTP.get("https://github.com/arviz-devs/arviz_example_data/blob/main/data/centered_eight.nc?raw=true"); | ||
|
||
julia> ds = NCDataset("centered_eight", "r"; memory = resp.body); | ||
|
||
julia> idata = from_netcdf(ds) | ||
InferenceData with groups: | ||
> posterior | ||
> posterior_predictive | ||
> sample_stats | ||
> prior | ||
> observed_data | ||
|
||
julia> idata_copy = copy(idata); # disconnect from the loaded dataset | ||
|
||
julia> close(ds);</code></pre></div></section></article><article class="docstring"><header><a class="docstring-binding" id="InferenceObjects.to_netcdf" href="#InferenceObjects.to_netcdf"><code>InferenceObjects.to_netcdf</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">to_netcdf(data, dest::AbstractString; group::Symbol=:posterior, kwargs...) | ||
to_netcdf(data, dest::NCDatasets.NCDataset; group::Symbol=:posterior)</code></pre><p>Write <code>data</code> to a NetCDF file.</p><p><code>data</code> is any type that can be converted to an <a href="../inference_data/#InferenceObjects.InferenceData"><code>InferenceData</code></a> using <a href="../inference_data/#InferenceObjects.convert_to_inference_data"><code>convert_to_inference_data</code></a>. If not an <code>InferenceData</code>, then <code>group</code> specifies which group the data represents.</p><p><code>dest</code> specifies either the path to the NetCDF file or an opened NetCDF file. If <code>dest</code> is a path, remaining <code>kwargs</code> are passed to <a href="https://alexander-barth.github.io/NCDatasets.jl/stable/dataset/#NCDatasets.NCDataset"><code>NCDatasets.NCDataset</code></a>.</p><div class="admonition is-info"><header class="admonition-header">Note</header><div class="admonition-body"><p>This method requires that NCDatasets is loaded before it can be used.</p></div></div><p><strong>Examples</strong></p><pre><code class="language-julia hljs">julia> using InferenceObjects, NCDatasets | ||
|
||
julia> idata = from_namedtuple((; x = randn(4, 100, 3), z = randn(4, 100))) | ||
InferenceData with groups: | ||
> posterior | ||
|
||
julia> to_netcdf(idata, "data.nc") | ||
"data.nc"</code></pre></div></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../diagnostics/">« Diagnostics</a><a class="docs-footer-nextpage" href="../inference_data/">InferenceData »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Sunday 17 December 2023 18:30">Sunday 17 December 2023</span>. Using Julia version 1.9.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
Oops, something went wrong.