Skip to content

Refactoring InferenceData as an AbstractDimTree #101

@sethaxen

Description

@sethaxen

With Python arviz v1.0, the InferenceData type is completely dropped in favor of xarray's own DataTree (see https://arviz-base.readthedocs.io/en/latest/tutorial/WorkingWithDataTree.html). Here I propose refactoring InferenceData as a subtype of the analogous DimensionalData.DimTree. Instead of using a DimTree directly, we'll probably want to implement our own AbstractDimTree subtype that we can use for dispatch.

Benefits of switching to DimTree include:

  • Mutability. Users can incrementally add groups to an InferenceData instead of doing it all-at-once or in stages and then mergeing.
  • Faster compile times. Beneath the hood DimTrees are like ordered dicts, while Datasets are liked NamedTuples. As a result, the same method operating on a Dataset will be faster (and probably type-inferrable), while it will have much longer compile times. In practice this lag from JIT-compiling is very noticeable, so in Reducing compilation time with InferenceData #15 I recommended sacrificing type-inferrability for improved interactive usability.

Downsides include:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions