Hi,
I have a slightly modified application of the pymc marketing MMM, for which I do not want to use the saturation transformation.
I have two kinds of purchases: With and without discount codes. For purchases with discount code, I know the marketing channel which triggered the purchase. For the others, I don’t. I now want to estimate which marketing channel caused the purchases without discount codes, assuming that every purchase must have been triggered by a channel (which is reasonable in my case).
My predictor variables are not costs, but purchases with adcodes. Therefore, the saturation transformation does not make sense.
How can I switch it off?
Thanks for any hint
Matthias
Hi @bayesian_padawan
You are able to define a custom Saturation transformation which the transformation y=x which would allow for an equivalent of no saturation transformation
import pandas as pd
from pymc_marketing.mmm import (
MMM,
GeometricAdstock,
SaturationTransformation,
)
class Identity(SaturationTransformation):
lookup_name = "identity"
def function(self, x):
return x
default_priors = {}
mmm = MMM(
adstock=GeometricAdstock(l_max=8),
saturation=Identity(),
date_column="date_week",
channel_columns=["x1", "x2"],
control_columns=[
"event_1",
"event_2",
"t",
],
yearly_seasonality=2,
)
data_url = "https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/data/mmm_example.csv"
data = pd.read_csv(data_url, parse_dates=["date_week"])
X = data.drop("y", axis=1)
y = data["y"]
mmm.fit(X, y)
1 Like