apply_sklearn_transformer_across_dim#

pymc_marketing.mmm.utils.apply_sklearn_transformer_across_dim(data, func, dim_name)[source]#

Apply a scikit-learn transformer across a dimension of an xarray DataArray.

Helper function in order to use scikit-learn functions with the xarray target.

Parameters:
  • data (DataArray) – The input data to transform.

  • func (Callable[[ndarray], ndarray]) – scikit-learn method to apply to the data

  • dim_name (str) – Name of the dimension to apply the function to

Return type:

xr.DataArray