Standardize#

class bayesflow.adapters.transforms.Standardize(mean: int | float | ndarray, std: int | float | ndarray)[source]#

Bases: ElementwiseTransform

Transform that when applied standardizes data using typical z-score standardization with fixed means and std, i.e. for some unstandardized data x the standardized version z would be

>>> z = (x - mean(x)) / std(x)

Important: Ensure dynamic standardization (employed by BayesFlow approximators) has been turned off when using this transform.

Parameters:
meanint or float

Specifies the mean (location) of the transform.

stdint or float

Specifies the standard deviation (scale) of the transform.

Examples

>>> adapter = bf.Adapter().standardize(include="beta", mean=5, std=10)
get_config() dict[source]#
forward(data: ndarray, **kwargs) ndarray[source]#
inverse(data: ndarray, **kwargs) ndarray[source]#
log_det_jac(data, inverse: bool = False, **kwargs) ndarray[source]#
__call__(data: ndarray, inverse: bool = False, **kwargs) ndarray#

Call self as a function.

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