Skip to content

Add transform helper #8

@OriolAbril

Description

@OriolAbril

There used to be a transform argument to plotting functions (maybe some stats too) which wasn't too useful as it only allowed a callable. I propose to instead create a transform helper.

def transform(idata, transform_funcs=None, group="posterior", return_dataset=False):
    if transform_funcs is None:
        transform_funcs = {}
    # loop over variables in `group` and check
    #    1) if there is a transform function mapped to it 
    #    2) if there are transformed values in the unconstrained group use that

Thus, without arguments it would combine the samples in posterior and unconstrained posterior to have all the samples in the unconstrained space. Not 100% sure about how the output should look like. I think it would be useful to allow returning that dataset directly, but it should also return a modified inferencedata/datatree, maybe with the unconstrained_posterior group but no posterior group? or viceversa which might play nicer with defaults in the rest of the functions?

Also, feel free to propose other names, I don't think transform is a particularly good choice as it is too general, maybe get_unconstrained_samples is more clear?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions