add_noise_to_channel_allocation#

pymc_marketing.mmm.utils.add_noise_to_channel_allocation(df, channels, rel_std=0.05, seed=None)[source]#

Return df with additive Gaussian noise applied to channels columns.

Parameters:
dfDataFrame

The original data (will not be modified in-place).

channelslist of str

Column names whose values represent media spends.

rel_stdfloat, default 0.05

Noise standard-deviation expressed as a fraction of the column mean (i.e. 0.05 ⇒ 5 % of the mean spend).

seedint or None

Optional seed for deterministic output.

Returns:
DataFrame

A copy of df with noisy spends.