tanh_saturation#

pymc_marketing.mmm.transformers.tanh_saturation(x, b=0.5, c=0.5)[source]#

Tanh saturation transformation.

\[f(x) = b \tanh \left( \frac{x}{bc} \right)\]

The tanh saturation function has a nice property that is useful when setting priors. The slope of the function when x is zero is \(\frac{1}{c}\). This means that you can set a prior by considering how many units of media are required to acquire the first customer. Unlike most other saturation functions, the slope at 0 is independent of the saturation point.

(Source code, png, hires.png, pdf)

../../_images/pymc_marketing-mmm-transformers-tanh_saturation-1.png
Parameters:
xtensor

Input tensor.

bfloat, by default 0.5

The saturation point. It represents the maximium number of customers that could be acquired through this channel at any point time. Must be non-negative.

cfloat, by default 0.5

Initial cost per user. Larger values represent less efficient channels. Must be non-zero.

Returns:
tensor

Transformed tensor.

References

See https://www.pymc-labs.com/blog-posts/reducing-customer-acquisition-costs-how-we-helped-optimizing-hellofreshs-marketing-budget/ # noqa: E501