Skip to content

Add transform_coords method to Transform method to automatically label unconstrained draws #7907

@jessegrabowski

Description

@jessegrabowski

Description

Certain transformations change the shape of a variable, which causes us to lose dimension information for the transformed variable. An example is SimplexTransform, which removes the last value of the core dimension. This means that when we return inference data for transformed values, we have to fall back to assigning new, unknown dims/labels, even though we actually know what these should be.

My proposal is to add a method to each transformation that knows what to do with labels. Then if we want to return the unconstrained samples for whatever reason, we can consult the relevant transformations and give the user back label dimensions as expected. Many of the most common transformations will just end up being the identity function.

This would add an abstractmethod to the Transform base class, something like:

class Transform(abc.ABC):
    ...

    @abc.abstractmethod
    def transform_labels(self, labels: Sequence[str]) -> Sequence[str]:
        """Mutate user-provided coordinates associated with the variable to label transformed values returned by this class"""

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions