NumpyTransform#
- class bayesflow.adapters.transforms.NumpyTransform(forward: str, inverse: str = None)[source]#
Bases:
ElementwiseTransform
A class to apply element-wise transformations using plain NumPy functions.
- Attributes:
- _forwardstr
The name of the NumPy function to apply in the forward transformation.
- _inversestr
The name of the NumPy function to apply in the inverse transformation.
Initializes the NumpyTransform with specified forward and inverse functions.
- Parameters:
- forwardstr
The name of the NumPy function to use for the forward transformation.
- inversestr, optional
The name of the NumPy function to use for the inverse transformation. By default, the inverse is inferred from the forward argument for supported methods.
- INVERSE_METHODS = {<ufunc 'arctan'>: <ufunc 'tan'>, <ufunc 'exp'>: <ufunc 'log'>, <ufunc 'expm1'>: <ufunc 'log1p'>, <ufunc 'log'>: <ufunc 'exp'>, <ufunc 'log1p'>: <ufunc 'expm1'>, <ufunc 'reciprocal'>: <ufunc 'reciprocal'>, <ufunc 'sqrt'>: <ufunc 'square'>, <ufunc 'square'>: <ufunc 'sqrt'>, <ufunc 'tan'>: <ufunc 'arctan'>}#
- classmethod from_config(config: dict, custom_objects=None) ElementwiseTransform [source]#