pymc-labs / pymc-marketing

Bayesian marketing toolbox in PyMC. Media Mix (MMM), customer lifetime value (CLV), buy-till-you-die (BTYD) models and more.
https://www.pymc-marketing.io/
Apache License 2.0
715 stars 201 forks source link

CLV quickstart plot title incorrect? #1178

Open cluhmann opened 3 weeks ago

cluhmann commented 3 weeks ago

In the section "Predicting Future Purchasing Behavior with the BG/NBD Model" of the CLV quickstart notebook, there are these 2 cells:

num_purchases = bgm.expected_purchases(future_t=10)

sdata = rfm_data.copy()
sdata["expected_purchases"] = num_purchases.mean(("chain", "draw")).values
sdata.sort_values(by="expected_purchases").tail(4)

ids = [841, 1981, 157, 1516]
ax = az.plot_posterior(num_purchases.sel(customer_id=ids), grid=(2, 2))
for axi, id in zip(ax.ravel(), ids, strict=False):
    axi.set_title(f"Customer: {id}", size=20)
plt.suptitle("Expected number purchases in the next period", fontsize=28, y=1.05);

The title of the plot (plus the text above it that says "We can plot the uncertainty in the expected number of purchases in the next period.") seems to imply that the posteriors are for a single period, but I think it's for the next 10 periods (because future_t=10). Am I missing something?

@ColtAllen

ColtAllen commented 5 days ago

Yes, the markdown text cells and chart title should be edited to reflect this is for the expected number of purchases over the next 10 time periods. Easy PR for anyone who wants to be mentioned as a contributor for the 0.11.0 release.

ColtAllen commented 2 days ago

Turns out the customer IDs for this chart also require updating. Fixing now.