Model_build raising NotImplemented Error with l_max set to nonzero

Hi there,

I’m relatively new to pymc-marketing and currently trying out the lift test calibration for my DelayedSaturatedMMM model. However, everytime i build the model, it raised this error: “NotImplementedError: At the moment, convolving with weight arrays that don’t have a concrete shape at compile time is not supported.”

When i looked at the detailed error message it seems like it’s coming from the adstock saturation…

NotImplementedError                       Traceback (most recent call last)
Cell In [199], line 1
----> 1 mmm.build_model(X_train, y_train)

File ~/venv/lib/python3.10/site-packages/pymc_marketing/mmm/delayed_saturated_mmm.py:440, in BaseDelayedSaturatedMMM.build_model(self, X, y, **kwargs)
    427 alpha = self.alpha_dist(
    428     name="alpha",
    429     dims="channel",
    430     **self.model_config["alpha"]["kwargs"],
    431 )
    432 lam = self.lam_dist(
    433     name="lam",
    434     dims="channel",
    435     **self.model_config["lam"]["kwargs"],
    436 )
    438 channel_adstock = pm.Deterministic(
    439     name="channel_adstock",
--> 440     var=geometric_adstock(
    441         x=channel_data_,
    442         alpha=alpha,
    443         l_max=self.adstock_max_lag,
    444         normalize=True,
    445         axis=0,
    446     ),
    447     dims=("date", "channel"),
    448 )

However, I have specified the adstock_max_lag as below and ensure the data format are all correct for the X (as dataframe) and y (as numpy ndarray) variables.

mmm = DelayedSaturatedMMM(
    model_config = my_model_config,
    sampler_config = sampler_config,
    date_column="week",
    channel_columns=spend_cols,
    control_columns=control_cols,
    adstock_max_lag=24,
    time_varying_intercept=True,
    yearly_seasonality=10,
)

mmm.build_model(X_train, y_train)

Could you advise on what I could be missing?

Thanks in advanced!

Hi Jennifer,

Interesting. How many data points do you have in the X_train? i.e. len(X_train)
Also, does this work with a smaller adstock_max_lag value? For example, adstock_max_lag=7

I tried adstock_max_lag = 8 and it still gave me the same error… the length of my training dataset is 109 and it’s in weeks so a little bit over 2 years…

Thanks for that information.
Are you changing the alpha hyperparameters?

Thanks for your feedback! Yes, i did set custom alpha params… is this what could be causing it?

Found the error! i was running it on tensorflow and now changed it to python 3.11 and it works :slight_smile:

1 Like