Group#

class bayesflow.adapters.transforms.Group(keys: Sequence[str], into: str, prefix: str = '')[source]#

Bases: Transform

Groups the given variables as a dictionary in the key into. As most transforms do not support nested structures, this should usually be the last transform.

Parameters:
keysSequence of str

The names of the variables to group together.

intostr

The name of the variable to store the grouped variables in.

prefixstr, optional

A common prefix of the ungrouped variable names, which will be removed after grouping.

Raises:
ValueError

If a prefix is specified, but a provided key does not start with the prefix.

get_config() dict[source]#
forward(data: dict[str, any], *, strict: bool = True, **kwargs) dict[str, any][source]#
inverse(data: dict[str, any], *, strict: bool = False, **kwargs) dict[str, any][source]#
extra_repr() str[source]#
log_det_jac(data: dict[str, any], log_det_jac: dict[str, any], inverse: bool = False, **kwargs)[source]#
__call__(data: dict[str, ndarray], *, inverse: bool = False, **kwargs) dict[str, ndarray]#

Call self as a function.

classmethod from_config(config: dict, custom_objects=None)#