pymc-devs/pymc

Refactor `EmpiricalGroup` to take `InferenceData` inputs

Open

#5,884 建立於 2022年6月12日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)Python (1,902 fork)batch import
VIhelp wantedtrace-backend

倉庫指標

Star
 (7,926 star)
PR 合併指標
 (平均合併 11天) (30 天內合併 7 個 PR)

描述

To decrease our dependence on MultiTrace, and to improve support for workflows were InferenceData objects are saved to disk, the EmpiricalGroup approximation should be refactored.

Currently it takes only MultiTrace inputs, but that's just because it needs access to transformed posterior draws. Since the approximation is created inside a modelcontext, it should be no problem to get the transforms from the Model and apply them to untransformed posterior draws.

Steps

  1. Write a function to transform posterior draws given a pm.Model instance and an xarray.Dataset (e.g. idata.posterior) containing untransformed draws.
  2. Refactor EmpiricalGroup to work with that xarray variable instead of a MultiTrace
  3. Maintain backwards-compatibility (with a deprecation warning) by automatically converting MultiTrace inhputs to InferenceData internally

貢獻者指南