Skip to content

Commit ed54b65

Browse files
committed
continue working on schema
1 parent 7ab1c4c commit ed54b65

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

doc/source/schema/schema.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,28 @@ Below are a few rules which should be followed:
5151
* Dimensions must be named and share name with a coordinate specifying the index values, called coordinate values.
5252
* Coordinate values can be repeated and should not necessarily be numerical values.
5353
* Variables must not share names with dimensions.
54-
55-
### Relations
54+
* Groups, variables or the InferenceData itself can have arbitrary metadata stored.
55+
56+
### Metadata
57+
No metadata is _required_ to be present in order to be compliant with the InferenceData schema.
58+
However, it is recommended to store the following fields when relevant:
59+
* `name`: InferenceData objects represent multiple quantities related to Bayesian modelling,
60+
but they are all tied to a single model. The model identifier can be added as metadata
61+
to simplify the calls to model comparison functions.
62+
* `created_at`: the date of creation of the group.
63+
* `arviz_version`: the version of the ArviZ library that generated the InferenceData
64+
* `arviz_language`: the programming language from which ArviZ was used to create the InferenceData
65+
* `inference_library`: the library used to run the inference.
66+
* `inference_library_version`: version of the inference library used.
67+
68+
69+
### Relations between groups
5670
`InferenceData` data objects contain any combination of the groups described below. There are also some relations (detailed below) between the variables and dimensions of different groups. Hence, whenever related groups are present they should comply with these relations. Neither the presence of groups nor described below or the lack of some of the groups described below go against the schema.
5771

5872
#### `posterior`
5973
Samples from the posterior distribution p(theta|y) in the parameter (also called constrained) space.
6074

75+
(schema/unconstrained_posterior)=
6176
#### `unconstrained_posterior`
6277
Samples from the posterior distribution p(theta_transformed|y) in the unconstrained (also called transformed) space.
6378

@@ -68,6 +83,15 @@ and if not, then the values from the variable in the `posterior` group should be
6883

6984
Both samples and variables (for those present only) should match between the `posterior` and the `unconstrained_posterior` groups. Note that as defined above, matching samples and variables impose constraints on dimensions and coordinates, not on the values which will be different.
7085

86+
:::{note}
87+
:class: dropdown
88+
89+
Both InferenceData groups and variables can have metadata, which in the `unconstrained_posterior`
90+
case could be used to store the transformations each variable goes through to map between the
91+
constrained and unconstrained spaces. The schema leaves this completely up to the user
92+
and imposes on conventions or restrictions on such metadata.
93+
:::
94+
7195
(schema/sample_stats)=
7296
#### `sample_stats`
7397
Information and diagnostics for each `posterior` sample, provided by the inference
@@ -162,6 +186,13 @@ generated during the adaptation process should be stored in groups with
162186
the same name with the `warmup_` prefix, e.g. `warmup_posterior`, `warmup_sample_stats_prior`.
163187

164188
#### Unconstrained groups
189+
Samples on the unconstrained space in cases where the samples need to be generated with
190+
the help of a sampling algorithm and the sampling algorithm requires transformations
191+
to an unconstrained space.
192+
193+
It is described in more detail in {ref}`schema/unconstrained_posterior` section, which
194+
is what we expect to be the most common section, but other groups could also have
195+
an unconstrained linked group, e.g. `prior` and `unconstrained_prior`.
165196

166197
## Planned features
167198
The `InferenceData` structure is still evolving, with some feature being currently developed. This section aims to describe the roadmap of the specification.

0 commit comments

Comments
 (0)